What are the advantages (or disadvantages) of having an enum versus having a set of static final ints in Java Android applications? Are there efficiency or performance optimizations that occur that favor the use of one or the other?
I ask this in context of say intent requestCodes and such – which tend to be ints in the Android sample code, as opposed to values from an enum, which I was used to in C.
Enum advantages from this question:
I would add:
intcan’t.Like most abstractions, they are generally unequivocally advantageous once their performance catches up. Especially in your application code (as opposed to framework code) I would choose enums over other methods that simulate them.