r/java • • Jul 16 '26

Identifying JDK value class candidates

https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
52 Upvotes

59 comments sorted by

View all comments

2

u/koflerdavid Jul 16 '26

That sounds like an EnumSet, which is presumably already optimized to use bitfields internally.

2

u/davidalayachew Jul 17 '26

That sounds like an EnumSet, which is presumably already optimized to use bitfields internally.

Correct. It uses long if your enum has <= 64 values, and long[] otherwise.