DevNotes
Support
Java · 23 chapters

Collection Framework

List, Set, Queue, Deque and Map implementations, HashMap internals, ConcurrentHashMap, load factor and fail-fast vs fail-safe iterators.

CHAPTER 01

Introduction to Java Collections Framework

Why collections exist, the problems with arrays, Collection vs Collections, and the overall hierarchy.

5 min · 8 Q&A · 17 examples
CHAPTER 02

Collection Interface (Deep Dive)

The root of List, Set and Queue — every core method, equality rules, and the Arrays.asList trap.

8 min · 12 Q&A · 33 examples
CHAPTER 03

List Interface

Ordered, index-based collections — List methods, ListIterator, Arrays.asList vs List.of and implementation choices.

6 min · 7 Q&A · 20 examples
CHAPTER 04

ArrayList

Internal working of the resizable array — size vs capacity, 1.5x growth, amortized O(1) and performance trade-offs.

7 min · 11 Q&A · 17 examples
CHAPTER 05

LinkedList

The doubly linked list behind LinkedList — nodes, head/tail, traversal cost, Deque operations and when it actually wins.

7 min · 11 Q&A · 14 examples
CHAPTER 06

Vector & Stack

The legacy synchronized list and LIFO stack — capacity increment, Enumeration, and why ArrayDeque replaced Stack.

6 min · 9 Q&A · 15 examples
CHAPTER 07

Set Interface

Uniqueness without positions — how Sets detect duplicates, and choosing between HashSet, LinkedHashSet and TreeSet.

6 min · 10 Q&A · 9 examples
CHAPTER 08

HashSet

HashSet's complete internal working — the backing HashMap, buckets, collisions, load factor, resizing and treeification.

17 min · 20 Q&A · 28 examples
CHAPTER 09

LinkedHashSet

HashSet plus predictable insertion-order iteration — the LinkedHashMap underneath, before/after links and memory trade-offs.

8 min · 13 Q&A · 15 examples
CHAPTER 10

TreeSet

Sorted, navigable sets on a Red-Black Tree — Comparable vs Comparator, compare() == 0 duplicates, and floor/ceiling/range views.

13 min · 15 Q&A · 34 examples
CHAPTER 11

Queue Interface

FIFO processing, the three method pairs (add/offer, remove/poll, element/peek), implementations and BlockingQueue.

10 min · 16 Q&A · 18 examples
CHAPTER 12

Deque Interface

The double-ended queue that is both a Queue and a Stack — method families, ArrayDeque's circular array and why it replaced Stack.

9 min · 14 Q&A · 15 examples
CHAPTER 13

PriorityQueue

Priority-ordered processing on a binary min-heap — sift-up, sift-down, max-heaps, custom priorities and Top-K patterns.

12 min · 15 Q&A · 24 examples
CHAPTER 14

Map Interface

Key-value storage — unique keys, core and Java 8 methods (computeIfAbsent, merge), views, and choosing the right Map.

15 min · 23 Q&A · 50 examples
CHAPTER 15

HashMap

HashMap from the inside — Node<K,V>, hash spreading, (n-1) & hash, put/get flows, collisions, treeification, load factor and resizing.

19 min · 11 Q&A · 30 examples
CHAPTER 16

LinkedHashMap

HashMap plus predictable ordering — before/after links, insertion vs access order, and building an LRU cache with removeEldestEntry().

12 min · 16 Q&A · 21 examples
CHAPTER 17

TreeMap

Sorted maps on a Red-Black Tree — ordering by key, comparator equivalence, floor/ceiling navigation, range views and rotations.

14 min · 6 Q&A · 31 examples
CHAPTER 18

WeakHashMap

Maps with weakly referenced keys — strong vs weak references, GC-driven entry removal, ReferenceQueue, and why it is not a cache.

14 min · 13 Q&A · 18 examples
CHAPTER 19

IdentityHashMap

A Map that compares keys with == instead of equals() — identity hashing, open addressing, object-graph use cases and String-pool traps.

14 min · 15 Q&A · 22 examples
CHAPTER 20

EnumMap

The array-backed Map for enum keys — ordinal positions, declaration-order iteration, null rules, EnumSet vs EnumMap and state machines.

15 min · 15 Q&A · 34 examples
CHAPTER 21

ConcurrentHashMap

Thread-safe maps without a global lock — Java 7 segments vs Java 8 CAS + bin locking, atomic compound operations, weakly consistent iterators and LongAdder.

24 min · 22 Q&A · 41 examples
CHAPTER 22

HashMap Internals

The full HashMap chain end to end — hash spreading, bucket math, collisions vs duplicates, treeification rules, resize bit-split, modCount and 50+ interview answers.

30 min · 49 Q&A · 28 examples
CHAPTER 23

Load Factor, Fail-Fast and Fail-Safe

How load factor, HashMap's lack of thread safety and the three iterator styles — fail-fast, weakly consistent and snapshot — connect.

5 min · 5 Q&A · 10 examples