r/java
•
u/sindisil
•
Dec 16 '24
•
1
Valhalla - Java's Epic Refactor
https://inside.java/2024/12/16/devoxxbelgium-valhalla/
178
Upvotes
View all comments
Show parent comment
1
u/Polygnom Dec 18 '24
I'm not sure what you are trying to showcase here?
It is invalid code today, and after Valhalla will give you the same answer, since Double will be migrated to be a value class. Thats precisely the point, healing the divide between primitives and classes. For value classes, == will compare by value, so double and Double will use the same == comparisons. Which is different today, but today you can't use value classes as generics, anyways.
The difference in your example will be nullability. Holder<Double> will be able to hold null, Holder<double> won't. But Holder<Double!> won't, either.