What are the advantages (or disadvantages) of having an enum
versus having a set of static final int
s in Java Android applications? Are there efficienc
A very simple answer from personal experiences would be that Enums provide much better type safety or in other words the compiler gets to play a more active role in keeping your code bug free.
On the other hand, because Enums are "second-class citizens" of the object world, they can be difficult to use in some of the more subtle design patterns commonly used today, especially when generics are involved.
And finally, you can use static final ints in a bitfield. you couldnt do the following with an enum:
int selectedOptions = Options.OPTION1 | Options.OPTION2 | Options.OPTION3;