Collections Refueled
summary
Library-level factory methods List.of/Set.of/Map.of provide unmodifiable, null-disallowing collections with up to ten fixed overloads (to avoid varargs allocation) plus varargs-of-entries for maps; duplicate keys cause an IllegalArgumentException, and internal implementations choose compact storage (example: a two-element set drops from ~152 bytes of HashSet wrapper overhead to ~20 bytes). Iteration is intentionally nonstable via a randomized iteration order per JVM run, serialization uses a proxy form, and JDK 10 adds copyOf methods and unmodifiable collectors.
AI-written summary · about
chapters (13)
- 0:00Start
- 0:32History of the Collections Framework in Java
- 5:00Java 9
- 5:10Collections Convenience Factory Methods
- 11:13Fixed Arg Overloads
- 13:49Creating an Unmodifiable List
- 21:17What Use Are Unmodifiable Collections
- 30:48Randomized Iteration Order
- 35:24Change the Iteration Order of Sets
- 38:32Duplicates Are Disallowed
- 42:34The Data Structure
- 44:37Serialization
- 46:14Jdk 10








