Tagged Questions
3
votes
1answer
343 views
What are the downsides of implementing a singleton with Java's enum?
Traditionally, a singleton is usually implemented as
public class Foo1
{
private static final Foo1 INSTANCE = new Foo1();
public static Foo1 getInstance(){ return INSTANCE; }
private ...
2
votes
2answers
588 views
Best practice for packing Java enums?
What is the best practice for packaging Java enums?
is it separate file for each enum?
or
having same file for all the enums?
What are the pros and cons ?
4
votes
2answers
797 views
Why would one ever want to use a synchronized method in Enum?
I stumbled upon this question and a couple of other along the same lines.
While we know creation of enum is thread safe and enums are by birth singletons .
It kind of confuses me that why would ...
6
votes
2answers
555 views
Java: would you use an EnumSet in this case?
I have this weird scenario in which some Java property is used to build and HQL query, and the type of the field is Boolean, i.e. it is boxed. I wondered why because I don't really like to think of ...