Skip to main content

5.1 Collections Framework Hierarchy & Core Interfaces

← Back to Chapter 5: Collections Framework

The Java Collections Framework (java.util) defines unified interfaces, polymorphic implementations, and high-performance utility algorithms for grouping objects.


1. Top-Level Hierarchy Architecture​

Iterable<T>
│
Collection<E>
┌─────────────────┼─────────────────┐
▼ ▼ ▼
List<E> Queue<E> Set<E>
(Ordered, dupes) (FIFO / heap) (Unique elements)
│ │
Deque<E> SortedSet<E>
(Double-ended) │
NavigableSet<E>

* Map<K, V> is a separate hierarchy (Key-Value mappings, not a Collection)

2. Core Interfaces & Characteristics​

InterfaceOrdering GuaranteeAllows Duplicates?Positional Indexing?Primary Concrete Implementations
List<E>Preserves insertion orderYesYes (get(int index))ArrayList, LinkedList, Vector
Set<E>Varies by implementationNo (enforces mathematical uniqueness)NoHashSet, LinkedHashSet, TreeSet
Queue<E>FIFO or Priority basedYesNo (poll(), peek())ArrayDeque, PriorityQueue, LinkedList
Deque<E>Double-ended (LIFO & FIFO)YesNoArrayDeque, LinkedList
Map<K, V>Varies by implementationUnique keys, duplicate valuesKey-based (get(Object key))HashMap, LinkedHashMap, TreeMap

3. Algorithmic Complexity Comparison​

Data StructureAccess by IndexSearch by ValueInsertion (Head/Tail)Deletion (Head/Tail)
ArrayListO(1)O(n)O(1) amortized tail / O(n) headO(1) tail / O(n) head
LinkedListO(n)O(n)O(1) head/tailO(1) head/tail
HashSetN/AO(1) averageO(1) averageO(1) average
TreeSetN/AO(log n)O(log n)O(log n)
HashMapN/AO(1) key lookupO(1) averageO(1) average
TreeMapN/AO(log n) key lookupO(log n)O(log n)
ArrayDequeN/AO(n)O(1) head & tailO(1) head & tail