~/talk

Collections Refueled

Talkat Oracle Developer Live—Java 2020 · on Tuesday, 2020-09-15· [java]
slides:none on file

Java 9/10 add concise factory APIs — List.of / Set.of / Map.of and map.ofEntries plus Map.entry and copyOf collectors — that produce unmodifiable (not immutable) collections, perform item‑potent copying (no extra copy when input is already unmodifiable), and deliberately randomize iteration order across JVM runs (demonstrated in jshell). map.of and related collectors throw on duplicate keys; use the three‑arg collector to merge. New implementations shrink memory: example two‑string set goes from 6 objects / 152 bytes to one object / 20 bytes.

AI-written summary · about

  1. 0:00Introduction
  2. 1:28Creating lists and sets
  3. 3:21Creating maps
  4. 4:49Overview of factory methods
  5. 6:52Map entries and arbitrary size
  6. 9:46Collection copy methods
  7. 11:39Idempotent copying
  8. 15:15Unmodifiability explained
  9. 19:02Iteration order and randomization
  10. 22:39JShell demonstration
  11. 25:07Duplicates and merging
  12. 28:17Space efficiency and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.