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
This should work.
Optional returnValue = Optional.empty(); if(secondScreenHeight.isPresent()) { returnValue = Optional.of(secondScreenHeight.getAsLong()); }