小编cae*_*kim的帖子

单线程应用程序中的 Hashtable 与 HashMap 性能

我知道Hashtable是同步的,所以在多线程应用程序中使用它是安全的,而HashMap不是。

我想知道在单线程应用程序中这两者之间是否有任何性能差异。

(或者,什么时候使用一个而不是另一个?)

java data-structures

4
推荐指数
3
解决办法
6314
查看次数

java结合两个链表

我有一个关于组合两个链表的问题.基本上,我想将一个链表附加到另一个链表.

这是我的解决方案.有没有更有效的方法来做到这一点而不循环第一个链表?任何建议将不胜感激.

    static Node connect(LinkedList list1, LinkedList list2) {
    Node original = list1.first;
    Node previous = null;
    Node current = list1.first;
    while (current != null) {
        previous = current;
        current = current.next;
    }
    previous.next = list2.first;
    return original;
}
Run Code Online (Sandbox Code Playgroud)

java collections linked-list

1
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×2

collections ×1

data-structures ×1

linked-list ×1