我何时应该使用arrayList?何时应该使用LinkedList?
什么时候应该使用TreeSet,LinkedHashSet并HashSet?
以下代码有什么作用?可以LinkedHashSet换成HashSet?
public class CollectionFunction {
public <E> List<E> function(List<E> list) {
return new ArrayList<E>(new LinkedHashSet<E>(list));
}
}
Run Code Online (Sandbox Code Playgroud) 我知道所有这些之间的区别,我理解LinkedHashMap并LinkedHashSet提供插入排序.我理解LinkedHashMap extends HashMap和LinkedHashSet extends HashSet.
为什么我们不总是使用LinkedHashMap而不是HashMap为什么我们不总是使用LinkedHashSet而不是HashSet?
java ×4
arraylist ×1
benchmarking ×1
collections ×1
hashmap ×1
hashset ×1
jvm ×1
jvm-hotspot ×1
linked-list ×1