Skip to content
Advertisement

How to map an OptionalLong to an Optional?

I have an instance of OptionalLong. But one of my libraries requires an Optional<Long> as a parameter.

How can I convert my OptionalLong into an Optional<Long>?

I was dreaming about something like this:

JavaScript

Advertisement

Answer

I don’t know simpler solutions but this will do what you need.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement