Java Collections Framework
Lists, Sets, Maps, Queues, the equals/hashCode contract, concurrent collections, and the modern Sequenced Collections API. The single most-asked area in any Java interview.
01Framework Overview & Hierarchy
JuniorNot started
Framework Overview & Hierarchy
How the framework is organized — Iterable, Collection, Map, the optional-operations contract, and why "Collection" and "Collections" are different things.
01Why does Map not extend Collection?Mid02What are "optional operations" and why does the framework use them?Mid03Walk through the entire Collection hierarchy from Iterable down.Junior02List, ArrayList, LinkedList
JuniorNot started
List, ArrayList, LinkedList
How ArrayList grows, when (almost never) to pick LinkedList, and the tarpit of Arrays.asList vs List.of vs Collections.unmodifiableList.
01How does ArrayList grow internally? What is the growth factor?Mid02Time complexity of add/remove/get for ArrayList vs LinkedList at head, middle, and tail.Mid03When would you actually choose LinkedList over ArrayList?Mid03Set, HashSet, LinkedHashSet, TreeSet
JuniorNot started
Set, HashSet, LinkedHashSet, TreeSet
The three production-grade Set implementations: hash-based, insertion-ordered, and sorted.
01How is HashSet implemented internally?Junior02Difference between HashSet, LinkedHashSet, and TreeSet — when to use each?Junior03Can HashSet contain null? How many nulls?Junior04Map, HashMap Internals
MidNot started
Map, HashMap Internals
The single most-asked Java topic. Inside hash(), resize(), treeification, load factor, and the contract for null.
01Walk through HashMap.put step by step.Mid02What is the default initial capacity and load factor? Why those values?Mid03Why must HashMap capacity always be a power of two?Senior05LinkedHashMap & LRU Cache
MidNot started
LinkedHashMap & LRU Cache
How LinkedHashMap weaves a doubly-linked list through HashMap, and how that gives you an LRU cache in 5 lines.
01How does LinkedHashMap maintain insertion order?Mid02What is access-order mode and how do you enable it?Mid03Implement an LRU cache using LinkedHashMap.Mid06TreeMap, NavigableMap, SortedMap
MidNot started
TreeMap, NavigableMap, SortedMap
Red-black tree under the hood, log-n everything, and the navigation API senior engineers use to solve interval problems.
01What data structure underlies TreeMap?Junior02Time complexity of TreeMap operations.Junior03Difference between SortedMap and NavigableMap.Mid07equals and hashCode Contract
MidNot started
equals and hashCode Contract
The contract every Java developer must internalize: five properties of equals, the hashCode invariant, and the inheritance trap.
01State the full equals contract (all 5 properties).Mid02State the hashCode contract.Mid03What breaks if you override equals but not hashCode?Mid08Comparable vs Comparator
JuniorNot started
Comparable vs Comparator
Natural ordering vs external ordering, and the "consistent with equals" trap most senior engineers can name but not explain.
01Difference between Comparable and Comparator.Junior02What does it mean for compareTo to be "consistent with equals"? Show BigDecimal.Senior03How do you sort by multiple fields using Comparator?Mid09Queue, Deque, ArrayDeque, PriorityQueue
MidNot started
Queue, Deque, ArrayDeque, PriorityQueue
The Queue throw-vs-return method matrix, why ArrayDeque replaces Stack, and the PriorityQueue iterator trap.
01Difference between throw-on-fail and return-special-value methods (add/offer, remove/poll, element/peek).Mid02Why is Stack considered legacy? What should you use instead?Junior03How is ArrayDeque implemented (circular buffer)?Mid10Iterator, ListIterator, Iterable, Spliterator
MidNot started
Iterator, ListIterator, Iterable, Spliterator
The iteration protocol, modCount and ConcurrentModificationException, and how Spliterator powers parallel streams.
01Difference between Iterator and ListIterator.Junior02What is fail-fast vs fail-safe?Mid03What is modCount and how does it cause ConcurrentModificationException?Mid11Concurrent Collections — ConcurrentHashMap
SeniorNot started
Concurrent Collections — ConcurrentHashMap
How CHM redesigned itself in Java 8, why size() is approximate, and the right way to use computeIfAbsent.
01How did ConcurrentHashMap design change from Java 7 to Java 8+?Senior02Why is size() approximate? What does mappingCount() do?Senior03What does "weakly consistent iterator" mean?Senior12BlockingQueue Family
SeniorNot started
BlockingQueue Family
The producer-consumer toolbox. Which queue each Executors factory uses, why newFixedThreadPool can take down production.
01BlockingQueue methods: put/take/offer/poll with timeout — when do they block?Mid02Differences between ArrayBlockingQueue, LinkedBlockingQueue, SynchronousQueue, DelayQueue, PriorityBlockingQueue, LinkedTransferQueue.Senior03Which BlockingQueue does each Executors factory method use?Senior13CopyOnWriteArrayList, ConcurrentSkipListMap, ConcurrentLinkedQueue
SeniorNot started
CopyOnWriteArrayList, ConcurrentSkipListMap, ConcurrentLinkedQueue
The lesser-known concurrent toolbox: copy-on-write for read-mostly state, skip list for sorted concurrent access, lock-free queues.
01When is CopyOnWriteArrayList the right choice? Wrong choice?Mid02Why does CopyOnWriteArrayList iterator never throw ConcurrentModificationException?Mid03ConcurrentSkipListMap vs TreeMap for concurrent sorted access.Senior14Collections Utility Class
JuniorNot started
Collections Utility Class
Static helpers and wrappers: unmodifiable vs immutable vs synchronized, and the algorithms most people forget.
01Difference between unmodifiable, immutable, and synchronized views.Mid02Collections.emptyList vs new ArrayList() vs List.of().Mid03Why does Collections.synchronizedList still require manual synchronization for iteration?Senior15Modern Features (Java 9–25)
MidNot started
Modern Features (Java 9–25)
Factory methods, Stream.toList, Sequenced Collections (Java 21), Records as map keys, virtual-thread implications.
01List.of, Set.of, Map.of — what are their semantics? Null hostility?Mid02Stream.toList vs Collectors.toList vs Collectors.toUnmodifiableList.Mid03Sequenced Collections (Java 21+) — what problem do they solve?Mid