~/talk

Java Collections Puzzlers

Talkat J-Fall 2023 · on Thursday, 2023-11-09· [java, testing]
slides:none on file

Interactive puzzlers test concrete Java behaviors: audience voting and GPT-4 competes against humans while runnable snippets reveal real surprises — Arrays.asList is a fixed-size view so removeIf throws UnsupportedOperationException, List.of/Stream.of differ on nulls causing NullPointerException, getOrDefault treats null as “absent” but get returns null, putIfAbsent returns the old value (leading to NPE) while computeIfAbsent gives a usable list, TreeSet vs HashSet equality is non‑commutative with custom comparators, and identity maps expose the Integer cache -128..127 quirk.

AI-written summary · about

  1. 0:00Welcome and introductions
  2. 3:57Primitive array in list
  3. 7:33Sublist view behavior
  4. 10:48Null handling in streams
  5. 14:24Arrays.asList and removeIf
  6. 17:13Map null values with getOrDefault
  7. 22:51Creating a multimap
  8. 27:05Map.putIfAbsent vs computeIfAbsent
  9. 30:34TreeSet and HashSet equals
  10. 35:12IdentityHashMap and boxing
  11. 40:11LinkedHashMap insertion order
  12. 43:55Unmodifiable collections equality
  13. 46:28Conclusions and wrap-up
~/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.