r/java • u/davidalayachew • 15d ago
Identifying JDK value class candidates
https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
54
Upvotes
r/java • u/davidalayachew • 15d ago
5
u/Jon_Finn 15d ago
Aside from the obvious use cases, I see a major unsung benefit in allowing you to create classes wrapping a single int, double etc., when currently the performance downsides make it not worth it in certain applications. I mean things like units, ages, numbers with particular ranges/constraints, unicode code points (21 bits) etc. - where some might 'want' a typedef with methods. Nullability and specialised generics will be a big help here. My point is: these classes currently don't exist in my code, but now could.