Stephan van Hulst wrote:The reason is that all the use cases that you can't use an enum for, are really bad use cases in the first place.
You mentioned that you only want a single SessionFactory. Absolutely fine! Just create a single instance and pass it around. Keeping it in a static field and letting dependent classes perform service lookups makes your code very messy and buggy.
The singleton pattern is dangerous to use for entities and services. And for value types enum is often easier. Unless you want to use composition, but you can always ask: why do I want to limit the number of objects created in the first place?
Kristina Hansen wrote:This might could help: https://stackoverflow.com/questions/12438567/java-bytecode-dup
Stephan van Hulst wrote:Like Campbell, I'm confused by what specifically you are referring to. I first though you were referring to the methods that accept a BiFunction or a BiConsumer.
If you are indeed referring to bitwise operators instead of binary operators, then it's because maps grow in powers of two, and bitwise operators are very natural for working with powers of two.
Campbell Ritchie wrote:I failed to get either of those links you posted to open. Please provide us with the correct URL.