Java collection classes
(i) Classification of collection classes: List, Set,queue (belongs to collection Interface), map (belongs to map interface)
Framework structure of the collection interface:
The frame structure of the map interface:
set Collection class:(Collections.synchronizedsortedset (new Setreet) is required to wrap the class in order to ensure multithreading security)
1,hashset Collection class: (Essence is the key value of HashMap, note its hashcode and Equals method, details can refer to:): Fast causes the stored value is calculated directly from the hash algorithm.
2,linkedhashset Collection Class: The order of storage is consistent with the order of addition, so in order to maintain the insertion of the list, its performance is reduced, it is better than hashset
3,treeset collection classes: Implemented by the SortedSet class, sorted in order, using sorting algorithm: Natural sort (red-black tree structure sort)
4,enumset Collection Class: Set for Enumeration (best in Set Set)
2,list Collection Class
ArrayList differs from Vector: the former is thread insecure and requires code assurance while the latter is thread-safe, but is not recommended for use.
Likedlist: Implements the Deque interface, can be used as a queue, stack, double-ended queue to use
3,queue Collection class:
1,piorityqueue: Not output in FIFO order, but as ascending of element, no NULL allowed
2,deque: Double-ended queue, using Arraydeque as a queue or as a stack operation (push into the stack, pop out of the stack)
4.Map Collection class:
The difference between 1,hashmap and Hashtable
2,linkedhashmap: two-terminal queue implementation
3,weakhashmap: For weak references, that is, the key value is anonymous and the wrapper reference is a weak reference.
4,identityhashmap: The insertion is not allowed only if the a==b is strictly equal, and HashMap is a.equals (b);
5,enummap:key must be an enumeration type (best performance in map)
(ii), the tool class that operates the collection------collections
1, Sort operations:
2, find, replace, etc. operation:
3, synchronous control operation:
Collections.synchronizedset ()----------collections.synchronizedlist ()---------------- Collections.synchronizedmap ()
Java-----------> Collection Classes