2 ms·
Can they go back and change Option though? Will we get a separate ValueOption type? This could get messy.
by pharmakom 4y ago
Can they go back and change Option though? Will we get a separate ValueOption type? This could get messy.
- cryptos 4y agoAs far as I remember from a post of Brian Goetz changing the existing Optional type is exactly the plan! So, Optional will become a zero-cost abstraction™ in Java. https://cr.openjdk.org/~briangoetz/valhalla/sov/02-object-model.html#migrating-value-based-classes-to-inline-classes https://cr.openjdk.org/~briangoetz/valhalla/sov/02-object-mo...
- Sankozi 4y agoOptional 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.html 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.