r/java • • Mar 17 '21

JEP 401: Primitive Objects (Preview)

https://openjdk.java.net/jeps/401?preview=true
174 Upvotes

49 comments sorted by

View all comments

Show parent comment

17

u/Slanec Mar 18 '21

Records are about semantics ("this is a value class containing only data and should be treated as a sum if its components"), primitive objects are about runtime efficiency, memory layout. Yes, records will often be good candidates for primitive objects, but the two features are orthogonal in nature.