It's been a long while since I read Effective Java, but I don't remember Bloch recommending modeling mutable singletons with enums. Not all singletons are mutable.
It's been a long while since I read Effective Java, but I don't remember Bloch recommending modeling mutable singletons with enums. Not all singletons are mutable.
Well sure, not all singletons are mutable. But by definition of him saying "use enums for singletons", that includes mutable singletons too, hence my point.
I'm not trying to say all enums should be mutable. I am saying that mutation in an enum can be a good thing if used right.
View all comments
Show parent comment
2
u/buerkle Oct 08 '25
It's been a long while since I read Effective Java, but I don't remember Bloch recommending modeling mutable singletons with enums. Not all singletons are mutable.