Module 03
Collections & Generics
How every major collection works internally, how to choose between them, and generics from basics to type erasure.
By the end of this module you can
- Explain HashMap internals down to treeification
- Pick the right collection for a workload and justify it
- Use wildcards and bounded types confidently
Collections framework
The hierarchy, complexity and choosing the right collection.
- The collections hierarchyFreeSoon
- Choosing the right collectionFreeSoon
- Big-O cheat sheet for collectionsPremiumSoon
- Collections framework: interview questions & scenariosPremiumSoon
Lists
ArrayList and LinkedList internals and trade-offs.
- How ArrayList worksFreeSoon
- How LinkedList worksPremiumSoon
- ArrayList vs LinkedListPremiumSoon
- Lists: interview questions & scenariosPremiumSoon
Maps
HashMap, LinkedHashMap, TreeMap and the specialised maps.
- How HashMap worksPremiumSoon
- Hashing, collisions and treeificationPremiumSoon
- LinkedHashMap and building an LRU cachePremiumSoon
- TreeMap and red-black treesPremiumSoon
- WeakHashMap, IdentityHashMap and EnumMapPremiumSoon
- Maps: interview questions & scenariosPremiumSoon
Sets
HashSet, LinkedHashSet and TreeSet internals.
- How HashSet, LinkedHashSet and TreeSet workPremiumSoon
- Sets: interview questions & scenariosPremiumSoon
Queues & deques
ArrayDeque, PriorityQueue and heaps.
- Queue, Deque and ArrayDequePremiumSoon
- PriorityQueue and binary heapsPremiumSoon
- Queues & deques: interview questions & scenariosPremiumSoon
Ordering & iteration
Comparable vs Comparator, iterators and ConcurrentModificationException.
- Comparable vs ComparatorFreeSoon
- Fail-fast vs fail-safe iteratorsPremiumSoon
- ConcurrentModificationException explainedPremiumSoon
- Ordering & iteration: interview questions & scenariosPremiumSoon
Generics
Generics from basics to erasure and wildcards.
- Generics basicsFreeSoon
- How type erasure worksPremiumSoon
- Wildcards and PECSPremiumSoon
- Bounded types and generic methodsPremiumSoon
- Generics: interview questions & scenariosPremiumSoon
Utilities & patterns
Utility methods, immutable collections and real-world patterns.
- Collections and Arrays utility methodsPremiumSoon
- Immutable collectionsPremiumSoon
- Collections in action: real-world patternsPremiumSoon
- Utilities & patterns: interview questions & scenariosPremiumSoon
Module interview question bank
Finish the module
Module interview question bankEvery interview question worth practising for Collections & Generics, grouped by topic, with model answers, how to say them and what-if follow-ups.