~/talk

Optional

Talkat Devoxx US 2017 · 2017-03-21..03-23· [java]
slides:none on file

Java 8’s Optional is a small (<20 methods) return-type box that replaces null results and is often misused; guidelines include never use null for Optional, avoid Optional.get unless proven present, prefer map/flatMap/orElse/ifPresent, and don’t convert nullable fields or method parameters into Optionals. Java 9 adds Optional.stream and ifPresentOrElse/or; Optional stays non‑serializable to preserve future value‑type plans (Project Valhalla). Antipatterns: nested Optionals, Optionals in collections, clever stream hacks that hurt readability and cause memory/GC overhead.

AI-written summary · about

  1. 0:00Introduction
  2. 0:40API without Optional
  3. 3:00Optional
  4. 5:56Find
  5. 7:27Get
  6. 8:15IsPresent
  7. 9:36Optional Get
  8. 10:37Optional Or Else
  9. 12:01Optional Map
  10. 13:57Chaining Methods
  11. 14:33Filter Method
  12. 16:42If Present
  13. 18:12Static Methods
  14. 19:26New Methods
  15. 24:10Examples
  16. 31:50Optional Methods
  17. 35:53Optional History
  18. 37:12Optional Serializable
  19. 39:09Optional and Field
  20. 42:29Summary 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.