wasn’t there a way to use enums like ints or somet...
# announcements
m
wasn’t there a way to use enums like ints or something? What was that called?
k
You mean calling
.ordinal
on them?
m
No, I meant you have a function (e.g. in the Android API) that wants an Int and will later return an Int. What you usually do is create a bunch of Int constants and use them, but I think I heard about declaring an enum in such a way that you could pass its values as an Int without calling .ordinal() on them.
Maybe I’m confusing it with another programming language…
k
There's
IntDef
in Android.
m
Yeah, guess there’s nothing better than that.
k
I kind of dislike
IntDef
, it solved a nonexistent problem. You get a bunch of articles like this talking about how enums make your dex files bigger, but meanwhile the play store is is filled with 60MB website wrappers. https://android.jlelse.eu/android-performance-avoid-using-enum-on-android-326be0794dc3