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
  • 225,348
  • 35
  • 301
  • 374
Jin Kwon
  • 18,308
  • 12
  • 99
  • 160

0 Answers0