- Queue Family
- Whether it is a queue or a stack, the Deque Implementation class is now commonly used : such as single-threaded arrayqueue, multithreaded Arrayblockingqueue
- Deque: Read as "Deck", is a "double-end queue", that is, support for head and tail data access and additions and deletions. ----support for stack and queue operations
- Relationship: Arraydeque---Deque (i), Collection (i), which represents the inheritance,--> represents the implementation, (i) represents the interface.
- Relationship: Vector->abstractlist, Stack. The Stack method is not as complete and stable as deque, so the Deque implementation class is preferred to represent the stack.
- List family
- Vector and ArrayList basically, are the collection family under the list of the implementation class, are mutable arrays, but vector is thread synchronization, ArrayList is not. Therefore, if there is no synchronization requirements, it is recommended to use ArrayList
- LinkedList implements a number of interfaces, such as List,deque, which are doubly linked lists, which are supported by the general operation of the list. But it is also single-threaded (that is, unsynchronized), but probably because it is too big? --not often used anyway
- Map family
- HashMap and Hashtable are similar. However, the HashMap is single-threaded (non-synchronous) and supports null (both the key and the value are null). The Hashtable is synchronous, and neither the key nor the value is null. Common HashMap
- Set family
- HashSet behind is hashmap in support, its add () operation is added is the key value, so hashset does not allow the insertion of duplicate values, of course, allowed to insert null (HashMap allow null key)
Above is my usual, here copy a summary of the article (which deprecated should refer to not used, not in favor of use, not abandoned): http://www.importnew.com/13801.html
|
Single Thread |
Concurrent |
| Lists |
ArrayList--based on a generic array
LinkedList--Not recommended for use
Vector--Obsolete (deprecated)
|
CopyOnWriteArrayList--almost not updated, often used to traverse
|
| Queues/deques |
-
Arraydeque --based on generic array
-
Stack -- Deprecated (deprecated)
-
Priorityqueue -The contents of the read operation are sorted
|
-
arrayblockingqueue -- Blocked queues with boundaries
-
Concurrentlinkeddeque/concurrentlinkedqueue --Borderless list queue (CAS)
-
delayqueue --element with deferred queue
-
Linkedblockingdeque/linkedblockingqueue --linked list queue (with lock), can be set with bounds
-
LinkedTransferQueue -The element ' transfer ' can be w/o stored
-
priorityblockingqueue --Concurrent priorityqueue
-
synchronousqueue --Using the Queue interface for Exchanger
|
| Maps |
HashMap--General Map
EnumMap--Key useenum
Hashtable--Obsolete (deprecated)
IdentityHashMap--use == the key to compare
LinkedHashMap--Keep the insertion order
TreeMap--Key is sorted
WeakHashMap--For caching (cache)
|
ConcurrentHashMap--General concurrency Map
ConcurrentSkipListMap--Sorted concurrency map
|
| Sets |
HashSet--Universal Set
EnumSet-- enum Set
BitSet--bit or dense integer set
LinkedHashSet--Keep the insertion order
TreeSet--Sort Set
|
ConcurrentSkipListSet--Sort Concurrent Set
CopyOnWriteArraySet--almost not updated, usually only do traversal
|
Java Common Collection class: Deque,arraylist,hashmap,hashset