Describe the Java Collections Framework hierarchy.

8 minbeginnercollectionshierarchybasics

Quick Answer

The framework splits into Collection (List, Set, Queue/Deque interfaces with implementations like ArrayList, HashSet, ArrayDeque) and Map (a separate hierarchy, since a map isn't a collection of single elements, with implementations like HashMap and TreeMap). Collections is a utility class of static helper methods, distinct from the Collection interface.

Detailed Answer

The framework is organized around two root interfaces:

Collection<E> — a group of elements:

  • List<E> — ordered, allows duplicates, indexed access (ArrayList, LinkedList, Vector)
  • Set<E> — no duplicates (HashSet, LinkedHashSet, TreeSet)
  • Queue<E> / Deque<E> — ordered for processing (FIFO/LIFO) (ArrayDeque, PriorityQueue, LinkedList)

Map<K, V> — key-value pairs, deliberately not a subtype of Collection (a map entry is a pair, not a single element): HashMap, LinkedHashMap, TreeMap, ConcurrentHashMap.

Collection            Map
├── List               ├── HashMap
│   ├── ArrayList       ├── LinkedHashMap
│   └── LinkedList      └── TreeMap
├── Set
│   ├── HashSet
│   ├── LinkedHashSet
│   └── TreeSet
└── Queue / Deque
    ├── ArrayDeque
    └── PriorityQueue

Note: Collections (plural, in java.util) is an unrelated utility class of static helpers (Collections.sort, Collections.unmodifiableList, Collections.emptyList) — easy to confuse with the Collection interface by name alone.

Most implementations also come in a concurrent flavor under java.util.concurrent (ConcurrentHashMap, CopyOnWriteArrayList, ConcurrentLinkedQueue) for thread-safe access without external synchronization.