3

I just found that OptionalInt and OptionalLong don't have map().

OptionalLong some() {
}

Optional<Something> doWithSome() {
    some()
    .map(find Something with the value)
    .orElseGet(() -> Optional.of(new Something()));
}

Why?

Óscar López
  • 232,561
  • 37
  • 312
  • 386
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184

0 Answers0