collections
lists, sets, maps, queues. what each one actually is in memory, and which to pick.
- 01the big picturethe interface family tree, from Iterable down to SequencedMap.
- 02ArrayListan array that grows. how much, when, and what it costs.
- 03LinkedList and ArrayDequenodes and pointers vs a circular buffer. (spoiler: use the deque.)
- 04HashMapbuckets, hashes, collisions, resizing. put a key in and watch where it lands.
- 05LinkedHashMap and LRU cachesa hashmap with a linked list threaded through it.
- 06TreeMap and sorted mapsa red-black tree that stays balanced while you insert.
- 07setsHashSet (a HashMap in disguise), TreeSet, and EnumSet (a bit vector).
- 08PriorityQueuea binary heap in an array. sift up, sift down.
- 09immutable collectionsList.of, copyOf, and unmodifiable views that aren't actually immutable.
- 10iterators and fail-fastmodCount and the ConcurrentModificationException you got in a single thread.
- 11sorting and comparatorsComparable, Comparator.comparing().thenComparing(), and TimSort.
- 12choosing a collectiona decision tree and a big-O cheat sheet.