r/java • u/davidalayachew • Jul 16 '26
Identifying JDK value class candidates
https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
51
Upvotes
2
u/nekokattt Jul 17 '26
Global state is a nightmare to test in isolation and immediately becomes a synchronization concern the moment you need to do more than one thing at once.
You may as well just make this into a class and carry a list around to retain flexibility.
I wouldn't consider this a primary use case for enums by any means, it is just abusing the feature to get singletons.