The Java Collections Framework (JCF) is a standardized architecture for storing, retrieving, and manipulating groups of objects. Before JDK 1.2, Java relied on disconnected legacy classes (Vector, Stack, Hashtable, Dictionary) lacking unified interfaces.
Figure 9: Comprehensive Java Collections Framework Architecture: Core Interfaces and Concrete Classes.
List<E> (Ordered & Duplicate-Friendly): Preserves insertion order and permits duplicate elements. Allows index-based access (get(index)). Implementations: ArrayList, LinkedList, Vector, Stack.Set<E> (Unique Elements): Prohibits duplicate elements (contains at most one null). Models mathematical sets. Implementations: HashSet, LinkedHashSet, TreeSet.Queue<E> & Deque<E> (FIFO & Double-Ended): Orders elements for processing prior to consumption. Implementations: PriorityQueue, ArrayDeque, LinkedList.Map<K,V> (Key-Value Mappings): Stores key-to-value associations. Keys must be unique; values can be duplicated. Implementations: HashMap, LinkedHashMap, TreeMap, ConcurrentHashMap.| Feature | Standard Arrays (T[]) |
Java Collections Framework |
|---|---|---|
| Size | Fixed length (cannot resize after creation) | Dynamic size (grows and shrinks automatically) |
| Type Support | Holds both primitives (int[]) and Objects |
Holds Objects only (uses wrapper autoboxing) |
| Memory Efficiency | Extremely fast, minimal memory overhead | Slight memory overhead due to Object wrappers and pointers |
| Built-In Algorithms | Manual loops or java.util.Arrays |
Rich out-of-the-box methods (sort, filter, shuffle, binarySearch) |
Exam Question: "What is the super-interface of the Collection interface?"
Answer: java.lang.Iterable<T>! Because Collection extends Iterable, every collection class in Java inherits the iterator() method and can be traversed using the enhanced for-each loop (for (T item : collection)) and forEach() with lambdas.
Now let us explore the most widely used collection in the world: the dynamically resizing ArrayList. Proceed to: Java ArrayList Class →
Accelerate your Java mastery by studying these tightly connected core tutorials:
Dynamic resizable arrays.
Key-value pair store.
Unique element sets.
Sorting and searching algorithms.