Optional and some other classes have a warning "This is a value-based class; ..." in the documentation (since Java 8 - see https://docs.oracle.com/javase/8/docs/api/java/util/Optional...). So it is documented that the way Optional is working might change in the future.