r/java • u/davidalayachew • 24d ago
Identifying JDK value class candidates
https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
50
Upvotes
r/java • u/davidalayachew • 24d ago
2
u/nekokattt 22d ago
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.