~/talk

Streams in JDK 8: The Good, the Bad, and the Ugly

Talkat Oracle OpenWorld 2017 · 2017-10-01..10-05· [java]
slides:none on file

Shows concrete JDK 8 pitfalls and fixes: code that returns null instead of Optional and calls String.split twice (inefficient), a URLDecoder that throws a checked UnsupportedEncodingException so extraction is moved to a helper and logging is used, replacing three-line dense streams with a readable stream/filter/collect using groupingBy to build month→day→count maps, replacing forEach/LongAdder state with filter/count, using Collectors.joining instead of O(n^2) reduce, and warning that parallel streams use the common ForkJoinPool (JDK9 fixes container CPU visibility).

AI-written summary · about

  1. 0:00Intro
  2. 0:32Goals Of This Session
  3. 2:10Problem To Solve
  4. 3:01Non-Stream Code
  5. 3:24My Stream Code (Ugly)
  6. 8:52Stream Code (Better)
  7. 10:10Stream Code (Better JDK 9)
  8. 13:47Not Thinking Functional
  9. 16:50Almost Functional (But Not Quite)
  10. 20:31Mixed Iteration (Bad)
  11. 23:08Internal Iteration (But Ugly)
  12. 24:11Internal Iteration (Good)
  13. 26:00Mixed Interation (Still Bad)
  14. 31:06Simple Exercise
  15. 33:03Alternative Reduction (Bad)
  16. 35:10Reduction By Collection (Complex)
  17. 39:08Stream Reuse (Good or Bad?)
  18. 40:51Multi-Sort (Bad)
  19. 41:27Parallel Streams Are Faster, Right?
  20. 43:42Custom Pools For Parallel Streams
  21. 45:19Conclusions
~/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.