A DESCRIPTION OF THE PROBLEM :
The documentation of java.util.Optional.empty() says:
>Though it may be tempting to do so, avoid testing if an object is empty by comparing with == against instances returned by Optional.empty(). There is no guarantee that it is a singleton. Instead, use isPresent().
This dates back to when there was no `isEmpty()`, however in Java 11 this method was added (JDK-8184693). Therefore the documentation for `empty()` should refer only, or additionally, to `isEmpty()`:
>Though it may be tempting to do so, avoid testing if an object is empty by comparing with == against instances returned by Optional.empty(). There is no guarantee that it is a singleton. Instead, use isEmpty().
Same for OptionalInt, OptionalDouble and OptionalLong.
The documentation of java.util.Optional.empty() says:
>Though it may be tempting to do so, avoid testing if an object is empty by comparing with == against instances returned by Optional.empty(). There is no guarantee that it is a singleton. Instead, use isPresent().
This dates back to when there was no `isEmpty()`, however in Java 11 this method was added (
>Though it may be tempting to do so, avoid testing if an object is empty by comparing with == against instances returned by Optional.empty(). There is no guarantee that it is a singleton. Instead, use isEmpty().
Same for OptionalInt, OptionalDouble and OptionalLong.