Collection Hierarchy in Java
The Java Collections Framework (JCF) is a unified architecture that provides interfaces, classes, and algorithms for storing and manipulating groups of objects. It simplifies working with data structures and allows developers to choose the right collection type based on their requirements.
Collections can store data in lists, sets, queues, or maps, each with distinct behavior.
Top-Level Interfaces in Collections
These are interfaces defined in the Collections Framework. They define behavior/contract that collection classes implement. Some are subinterfaces.

Hierarchy Diagram of Top-Level Interfaces
Iterable (Root interface)
│
Collection (Parent)
┌─────────────┬─────────────┬─────────────┐
│ │ │
List Set Queue
│ │ │
┌───────┴───────┐ │ ┌───────┴───────┐
│ │ │ │ │
ArrayList LinkedList HashSet LinkedHashSet PriorityQueue
Vector Stack TreeSet NavigableSet ArrayDeque
Map (Separate)
├──────────────┬─────────────┬──────────────┐
HashMap LinkedHashMap TreeMap (SortedMap) NavigableMap
1. Iterable (Root Interface)
- The root interface for all collection types.
- Provides the
iterator()method to traverse elements. - Supports enhanced
for-eachloops.
Iterable
└── Collection
2. Collection Interface
- Base interface for storing a group of objects.
- Extends
Iterable. - Subinterfaces: List, Set, Queue, Deque.
- Key methods:
add(),remove(),size(),contains(),iterator().
Example:
Collection<String> coll = new ArrayList<>();
coll.add("Apple");
coll.add("Banana");
System.out.println(coll.contains("Apple")); // true
Note: Map is not part of the Collection hierarchy.
3. List Interface
- Ordered collection, allows duplicates, supports index-based access.
- Maintains insertion order.
Common Implementations: ArrayList, LinkedList, Vector, Stack.
Example:
List<String> list = new ArrayList<>();
list.add("A");
list.add("B");
list.add("A"); // duplicates allowed
System.out.println(list); // [A, B, A]
4. Set Interface
- Stores unique elements only, no duplicates.
- No index-based access, unordered by default.
Common Implementations: HashSet, LinkedHashSet, TreeSet.
Example:
Set<String> set = new HashSet<>();
set.add("A");
set.add("B");
set.add("A"); // duplicate ignored
System.out.println(set); // [A, B] (unordered)
5. Queue Interface
- Holds elements for processing in FIFO order (or priority-based).
- Useful for task scheduling, event processing, or buffering.
Common Implementations: PriorityQueue, LinkedList, ArrayDeque.
Example:
Queue<Integer> queue = new LinkedList<>();
queue.add(10);
queue.add(20);
System.out.println(queue.poll()); // 10 (FIFO)
6. Deque Interface
- Double-ended queue, allows insertion/removal at both ends.
- Supports FIFO, LIFO, and double-ended operations.
Common Implementations: ArrayDeque, LinkedList.
Deque (Double-Ended Queue)
Queue ──> Deque
├── ArrayDeque
└── LinkedList
Example:
Deque<String> deque = new ArrayDeque<>();
deque.addFirst("A");
deque.addLast("B");
System.out.println(deque); // [A, B]
7. Map Interface
- Stores key-value pairs, keys are unique, values may duplicate.
- Not part of
Collection, but a top-level interface.
Common Implementations: HashMap, LinkedHashMap, TreeMap, NavigableMap.
Map Hierarchy (Separate Branch)
Map
├── HashMap
├── LinkedHashMap
├── TreeMap (SortedMap)
│ └── NavigableMap
└── Hashtable (Legacy)
Example:
Map<String, Integer> map = new HashMap<>();
map.put("A", 100);
map.put("B", 200);
System.out.println(map.get("A")); // 100
8. SortedSet & NavigableSet
- SortedSet: Maintains elements in sorted order. Example: TreeSet.
- NavigableSet: Adds navigation methods like
ceiling(),floor(),higher(),lower().
SortedSet & NavigableSet
Set (Specialized)
└── SortedSet
└── NavigableSet
Example:
NavigableSet<Integer> navSet = new TreeSet<>();
navSet.add(10);
navSet.add(20);
System.out.println(navSet.ceiling(15)); // 20
9. SortedMap & NavigableMap
- SortedMap: Keys are stored in sorted order. Example: TreeMap.
- NavigableMap: Adds navigation methods like
ceilingKey(),floorKey(),higherKey(),lowerKey().
SortedMap & NavigableMap
Map (Specialized)
└── SortedMap
└── NavigableMap
Example:
NavigableMap<Integer, String> navMap = new TreeMap<>();
navMap.put(1, "A");
navMap.put(3, "C");
System.out.println(navMap.higherKey(1)); // 3
Types of Collections (Functional Categories)

| Type | Description |
|---|---|
| List | Ordered collection, duplicates allowed, index-based |
| Set | Unique elements, unordered/sorted, no index |
| Queue | FIFO or priority-based collection |
| Deque | Double-ended queue, supports both ends |
| Map | Key-value pairs, keys unique, values may duplicate |
Subinterfaces like SortedSet, NavigableSet, SortedMap, and NavigableMap are specialized versions of Set or Map.
Flowchart – Full Collection Hierarchy
Start
│
▼
Iterable (Root)
│
▼
Collection
│
├───────────────┬───────────────┬───────────────┐
▼ ▼ ▼ ▼
List Set Queue Map
│ │ │ │
▼ ▼ ▼ ▼
ArrayList HashSet PriorityQueue HashMap
LinkedList LinkedHashSet LinkedList LinkedHashMap
Vector TreeSet ArrayDeque TreeMap (SortedMap)
Stack SortedSet Deque NavigableMap
NavigableSet
Key Points to Remember
- Iterable → Root interface for iteration using
iterator()or for-each loops. - Collection → Base for List, Set, Queue, Deque.
- List → Ordered, allows duplicates, index-based access.
- Set → Unique elements, duplicates not allowed.
- Queue → FIFO / priority-based collection.
- Deque → Double-ended queue, supports both ends.
- Map → Key-value pairs, keys unique, values may duplicate.
- SortedSet/NavigableSet → Sorted elements, navigational methods.
- SortedMap/NavigableMap → Sorted keys, navigational methods.
- Legacy Collections → Vector, Stack, Hashtable, Enumeration.
