optional: java.util.Optional module (factories, extraction, orElse vs orElseGet, anti-patterns, Stream interop, JSpecify contrast)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6gdUKYmBw6bUKcM7t
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
cca173d104
commit
47e4ccbefa
@@ -0,0 +1,10 @@
|
||||
isPresent : true
|
||||
isEmpty : true
|
||||
get (present): Mumbai
|
||||
get (empty) : java.util.NoSuchElementException: No value present
|
||||
orElseThrow(): java.util.NoSuchElementException: No value present
|
||||
orElse : Unknown City
|
||||
orElseGet : DefaultCity
|
||||
orElseThrow(s): java.lang.IllegalStateException: City must be set
|
||||
ifPresent : City is Mumbai
|
||||
ifPresentOrElse: No city configured
|
||||
Reference in New Issue
Block a user