Collections Refueled
summary
Java 9 adds library-only convenience factory methods like List.of/Set.of/Map.of and Map.ofEntries/Map.entry that produce new, unmodifiable collection implementations which disallow nulls and (for sets/maps) duplicate keys, randomize iteration order per JVM start, and prioritize space efficiency over raw HashMap speed — e.g., storing two elements drops overhead from roughly 152 bytes to 20 bytes. Java 10 adds copyOf and unmodifiable collectors to snapshot mutable data into these compact, serializable, unmodifiable structures.
AI-written summary · about
chapters (22)
- 0:00Introduction
- 0:35History
- 2:00Collections Convenience Factory
- 2:38Background
- 3:46New API
- 4:51Math API
- 5:58Examples
- 7:17Map
- 8:05Map Entries
- 8:47Unmodifiable
- 14:30Unmodifiable Use Cases
- 16:26Unmodifiable Collections
- 17:45Nulls disallowed
- 19:02Randomized iteration order
- 22:23Other programming systems
- 25:00Duplicates
- 25:50Duplicates Example
- 26:56Compact
- 29:37Overhead
- 31:17Small Collections
- 32:23SetCopyOf
- 37:02Summary








