Mentioned by Rémi in http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-December/050477.html
It seems that are no simple way to transform an Optional<Integer> to an OptionalInt and vice-versa.
It's painful because we start to see interface that returns by example OptionalInt while the implementation you want to connect with return an Optional<Integer>.
The only workaround seems to be to use a Stream/IntStream:
Optional -> OptionalInt
optional.stream().mapToInt(x -> x).findFirst()
OptionalInt -> Optional
I think, Optional should have the method mapTo*/flatMapTo* and Optional[Primitive] the method boxed().