A collection of simple summary

Collection collection / Interface
List collection / Interface
Features: orderly and repeatable
ArrayList:
LinkedList:
the Vector: JDK1.0 there
Stack:

Set集合/接口
特点:无序不可重复
    HashSet:
    LinkedHashSet:有序的
    TreeSet:

Map collection / Interface
Features:
key-value pairs Key-Value
guarantee key uniqueness
HashMap:
the HashTable:
ConcurrenHashMap:
LinkedHashMap:
TreeMap:

Note:
the difference between the set and the Map Collection collection?
Collection set is stored in a single object
Map is set storage key-value pairs (Key-Value)

对于无序的理解:
    无序不代表随机,无序是指存入顺序与取出顺序不一致
泛型:
    是一种数据安全的做法,规定了集合应该存储什么样的数据类型
    
集合的应用场景:
    ArrayList:存储数据,线程不安全
    LinkedList:存储数据,队列模式和栈模式
    Vector:存储数据,线程安全的       
    Stack(继承Vector):栈模式
    HashSet:存储数据,去重
    LinkedHashSet:存储数据,去重,有序的
    TreeSet:存储数据,自然排序
    
    HashMap:存储数据-键值对形式,key可以去重,可以存null键null值,线程不安全
    Hashtable:存储数据-键值对形式,key可以去重,不可以存null键null值,线程安全
    ConcurrentHashMap:存储数据-键值对形式,key可以去重,不可以存null键null值,线程安全,分段式加锁,效率更快
    LinkedHashMap:存储数据-键值对形式,key可以去重,可以存null键null值,线程不安全,有序的
    TreeMap:存储数据-键值对形式,针对于key排序
    
排序接口:
    Comparable
    Comparator
排序优先级别:Comparator > Comparable

Thread-safe: Vector, Hashtable, ConcurrentHashMap,
orderly and repeatable: ArrayList, Vector, LinkedList, Stack
disorder and can not be repeated: HashSet, LinkedHashSet (ordered unrepeatable), TreeSet
deduplication: HashMap, Hashtable, ConcurrentHashMpa , LinkedHashMap, HashSet, LinkHashSet
deduplication TreeMap TreeSet and is determined by methods comparable in the interface compareto
there may be a null key and a null value: HashMap, LinkedHashMap

Guess you like

Origin www.cnblogs.com/cqzy/p/11272560.html