Records are just a quick and safe way to declare immutable (reference) classes, but they don't change how the JVM stores the object at all. Primitive types will work well with records, the focus here is not storing references to objects but storing the primitive values directly on the stack (or in parent objects).
This is mostly to improve performance and memory usage, but will also allow you to create variables that can't be null.
3
u/Emax__ Mar 18 '21
How do they differ from records?