2020-12-31 java之数组

1.集合除了map以外 都实现了collection接口 所以总体关系是

collectin > {set,queue,list}  set >{enumset,sortedset,hashset} list>{linkedlist,arraylist,vector} queue>{deque,priorityqueue}

sortedset>treeset, hashset>linkedhashset ,vector>stack

map>{EnumMap,HashMap,HashTable,SortedMap,WeakHashMap}

HashMap>LinkedHashMap  

HashTable>Properties

SortedMap>TreeMap

hashset 和LinkedHashSet区别:

共同点:都是通过hashcode计算得到存储位置

不同点:hashset 元素无序。LinkedHashSet 维护了一张链表来记录元素插入次序。所以是有序得

TreeSet特性:元素有序不过不是插入顺序 而是根据元素大小进行排序。并且存储位置是根据红黑树得数据结构来进行存储得并不是根据hashcode计算

linkedlist:采用链表存储元素 

线程安全:Properties(集合中元素不可为null),vector, hashTable

线程不安全:hashset ,LinkedHashSet ,TreeSet,enumset,arraylist,linkedlist

你可能感兴趣的:(2020-12-31 java之数组)