Guest User

Untitled

a guest
Jan 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. String myFunction(Optional<ClassWithIdAsString> instanceWithIdAsString, Optional<ClassWithIdAsLong> instanceWithIdAsLong) {
  2.  
  3. String id = instanceWithIdAsString.map(ClassWithIdAsString::getId)
  4. .map(id -> String.valueOf(id))
  5. .orElseGet(t -> instanceWithIdAsLong
  6. .map(ClassWithIdAsLong::getId));
  7. return id;
  8. }
Add Comment
Please, Sign In to add comment