Common collections and characteristics of Java

Collection type Features inheritance relationship
ArrayList Dynamic arrays can automatically adjust capacity as needed and support random access and fast insertion and deletion. AbstractCollection -> AbstractList
LinkedList Doubly linked list supports fast insertion and deletion, but accessing elements is slow AbstractCollection -> AbstractSequentialList -> AbstractList
Vector Dynamic array, similar to ArrayList, supports dynamic growth and is thread safe AbstractCollection -> AbstractList
CopyOnWriteArrayList Dynamic array, thread-safe, suitable for concurrent environments AbstractCollection -> AbstractList
Stack Stack, last-in-first-out data structure AbstractCollection -> AbstractList -> Vector
HashSet Unordered set, no duplicate elements allowed, implemented based on hash table, fast insertion and search speed AbstractCollection -> AbstractSet
TreeSet Ordered set, no duplicate elements allowed, implemented based on red-black tree, fast insertion and search speed AbstractCollection -> AbstractSet
HashMap Key-value pair mapping table, no duplicate keys are allowed, implemented based on hash table, fast insertion and search speed AbstractMap
TreeMap Key-value pair mapping table, no duplicate keys are allowed, implemented based on red-black tree, sorted by the natural order of keys AbstractMap
LinkedHashMap Ordered key-value pair mapping table, no duplicate keys allowed, implemented based on hash table and doubly linked list, sorted by insertion order AbstractMap -> HashMap
PriorityQueue Priority queue, implemented using a heap, can be sorted according to the priority of elements AbstractCollection -> AbstractQueue
Queue Queue, a first-in, first-out data structure Interface Iterable -> Interface Collection -> Interface Queue
Hashtable Key-value pair mapping table, no duplicate keys allowed, thread-safe Dictionary
EnumSet An enumeration collection can only store elements of the enumeration type AbstractCollection -> AbstractSet
ConcurrentHashMap Key-value pair mapping table, thread-safe, suitable for concurrent environments AbstractMap
ConcurrentSkipListSet Ordered collection, thread-safe, suitable for concurrent environments AbstractCollection -> AbstractSet -> ConcurrentSkipListSet
ConcurrentLinkedDeque Double-ended queue, thread-safe, suitable for concurrent environments AbstractCollection
LinkedBlockingQueue Blocking queue, thread-safe, suitable for concurrent environments AbstractCollection -> AbstractQueue
PriorityBlockingQueue Priority queue, thread-safe, suitable for concurrent environments AbstractCollection -> AbstractQueue
ArrayBlockingQueue Bounded blocking queue, thread-safe, suitable for concurrent environments AbstractCollection -> AbstractQueue
LinkedHashSet Ordered set, no duplicate elements allowed, implemented based on hash table and doubly linked list, sorted in insertion order AbstractCollection -> AbstractSet -> HashSet
IdentityHashMap Key-value pair mapping table, use reference equality to determine the equality of keys instead of using the equals() method AbstractMap
WeakHashMap Key-value pair mapping table uses weak references as keys. When the keys are no longer referenced, they can be garbage collected. AbstractMap
EnumMap The key-value pair mapping table can only store enumeration type keys and is implemented based on arrays. AbstractMap
Properties A map of key-value pairs for processing property files Dictionary
BitSet Bit collection, which can perform bit operations and is used to store and operate bit data AbstractCollection

Welcome to follow the public account [Mashang Hunter] (*`▽´*) Come on, long live open source!

Guess you like

Origin blog.csdn.net/rice2020/article/details/131581390