Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java 'struct' request

Peter QuiringNov 19 2018 — edited Nov 19 2018

I would like to see Java include a light-weight class called a 'struct'.  I originally thought that is what Valhalla was going to be but it seems to be more like a user-defined type that is not a reference.  So a Valhalla object must be 'copied' in full with each assignment.  Good for small tuples.

I was hoping for something more like a 'struct' which would be similar to a 'class' but is more light-weight (a struct would still be a reference but does NOT derive from Object but maybe something called Structure)  It could still have members but because it's a reference you could assign it to other struct references much faster than a Valhalla object.  The overhead of a full 'class' causes much of the 'bloat' in Java.  A leaner 'struct' I think would help reduce memory usage (no monitor or any virtual functions in the base class Structure).

Thanks,

Comments
Post Details
Added on Nov 19 2018
0 comments
287 views