The IntStream class has map(), mapToObj(), mapToLong() and mapToDouble() methods, but those methods seem to be missing from the OptionalInt class.
Is there a good reason for those methods to be missing?
The IntStream class has map(), mapToObj(), mapToLong() and mapToDouble() methods, but those methods seem to be missing from the OptionalInt class.
Is there a good reason for those methods to be missing?
Rather obtusely you can do
OptionalInt oi = OptionalInt.of(1);
oi.ifPresent(i -> IntStream.of(i).map(j -> j + 1).forEach(System.out::println));
However it is not clear why OptionalInt doesn't have the same methods as IntStream although I note Optional has a subset of Stream