I have an instance of OptionalLong. But one of my libraries requires an Optional as a parameter.
OptionalLong
Optional
How can I convert my Option
Option
You could do this:
final OptionalLong optionalLong = OptionalLong.of(5); final Optional optional = Optional.of(optionalLong) .filter(OptionalLong::isPresent) .map(OptionalLong::getAsLong);