Java Collection Framework

Collection

Sets

HashSet – implements set, backed by hash table

LinkedHashSet – implements set, backed by hash table and linked list (predictable order)

SortedSet – set with natural or Comparator ordering

NavigableSet – sorted set extended with navigation methods: lower, floor, ceiling, higher

TreeSet – implements sorted and navigable set backed by tree map

Ordered Lists

List – ordered sequence

ArrayList – non synchronized resizable array, internaly stored as []

LinkedList – non synchronized double-linked list and deque implementation (List list = Collections.synchronizedList(new LinkedList(…));)

Vector – legacy array implementation

Stack Class

Stack – extend Vecor as LIFO stack

Queues

Queue – collection for holding elements prior to processing

PriorityQueue – ordered queue based on natural ordering or Comparator

Double-ended queues

Deque – collection that support both end, first and last element processing

ArrayDeque – array implementation of deque

LinkedList – deque implementation

 

Maps

Hashtable – legacy implementation of hash map

HashMap Order no guarantee order will remain constant over time Get/put remove containsKey O(1) Interfaces Map Null values/keys allowed Fail-fast behavior Fail-fast behavior of an iterator cannot be guaranteed impossible to make any hard guarantees in the presence of unsynchronized concurrent modification Implementation buckets Is synchronized implementation is not synchronized

LinkedHashMapOrder insertion-order Get/put remove containsKey O(1) Interfaces Map Null values/keys allowed Fail-fast behavior Fail-fast behavior of an iterator cannot be guaranteed impossible to make any hard guarantees in the presence of unsynchronized concurrent modification Implementation double-linked buckets Is synchronized implementation is not synchronized

SortedMap – provide map ordered base on natural ordering or Comparator

NavigableMap – sordet map extended with navigation: lowerEntry, floorEntry, ceilingEntry, and higherEntry. lowerKey, floorKey, ceilingKey, and higherKey return only the associated keys

TreeMapOrder sorted according to the natural ordering (compareTo or externally supplied Comparator) Get/put remove containsKey O(log(n)) Interfaces NavigableMap Map SortedMap Null values/keys only values Fail-fast behavior Fail-fast behavior of an iterator cannot be guaranteed impossible to make any hard guarantees in the presence of unsynchronized concurrent modification Implementation Red-Black Tree Is synchronized implementation is not synchronized

WeakHashMap – hash map implementation with key removing when is no longer in ordinary use

EnumMap

IdentityHashMap

 

Leave a comment

Your email address will not be published. Required fields are marked *