Guest User

Untitled

a guest
Dec 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public Option<String> flatMapOptionOfOption(String nullableText) {
  2. Option<Option<String>> optionOfOption = Option
  3. .of(nullableText)
  4. .map(s -> optionWrapper(s)); // we're inside map - an Option context - abd call another method returning an Option leaving us with an Option<Option<String>>
  5.  
  6. /* !! NOT THE WAY TO GO !! */ return optionOfOption.get(); /* !! NOT THE WAY TO GO !! */
  7. }
Add Comment
Please, Sign In to add comment