3 ms·
The issue will probably be solved this year with value types in Java. https://openjdk.org/jeps/8277163 https://openjdk.org/jeps/8277163, https://www.baeldung.c
by cryptos 4y ago
The issue will probably be solved this year with value types in Java.
https://openjdk.org/jeps/8277163 https://openjdk.org/jeps/8277163,
https://www.baeldung.com/java-valhalla-project https://www.baeldung.com/java-valhalla-project,
https://blogs.oracle.com/javamagazine/post/java-jdk-18-evolution-valhalla-panama-loom-amber https://blogs.oracle.com/javamagazine/post/java-jdk-18-evolu...
- pharmakom 4y agoCan 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.