Free lessons · Made by VeraStack Labs
Java Collections
The tools Java ships with, one lesson at a time.
The framework
Part 1: the framework
Thirteen lessons planned. Thirteen are ready.
- 00Setting up, and how to read these pagesJDK 21, javac, java, jshell
- 01The big pictureCollection, List, Set, Queue, Map
- 02Generics, just enoughList<String>, the diamond, boxing
- 03ArrayListA growing array, and the cost of the middle
- 04LinkedListNodes, and why it is rarely the right choice
- 05Iterating safelyfor-each, Iterator, ConcurrentModificationException
- 06HashSet and HashMapHashing, buckets, getOrDefault, merge
- 07equals and hashCodeThe contract, and the bug when you break it
- 08Ordered collectionsLinkedHashMap, TreeMap, Comparable, Comparator
- 09Queues and dequesArrayDeque as stack and queue, PriorityQueue
- 10The helpersCollections, Arrays, List.of immutability
- 11Choosing a collectionA decision guide to bookmark
- 12Interview round-upFail-fast, concurrent collections, common traps
How a lesson is built
Seven parts, every time
So you always know where the cost table is.
- 01What it is
- 02The idea
- 03Use it
- 04How it works
- 05Cost
- 06Practise
- 07Interview notes
Every piece of Java on these pages is a real file that is compiled and run with assertions on before the page is built, so the code you read is the code that ran. Your progress is kept in this browser only. Nothing is sent anywhere.
Made by VeraStack Labs