I need to make an enum for android ApplicationInfo...
# announcements
d
I need to make an enum for android ApplicationInfo flags:
Copy code
enum class PackageFlags(val mask: Int) {
	NONE(0), SYSTEM_APP(1), IS_DEBUGGABLE(2), SYSTEM_APP_UPDATED(128), IN_SD_CARD(262144),
	IS_DATA_ONLY(16777216), IS_STOPPED(2097152)
}
e
Take in account that if you use enums intensively and you need performances, you should use `Int`s instead
EnumSet
d
But I thought the whole point of enumset was for performance with its backing bitwise storage of enums? Whereas regular kotlin enums create a new class for each instance. Or maybe enumset does too when wrapping a kotlin enum?
Unless you mean using Int constants for masks with Int flag storage, which might be less clean...?
e
No, the point of using
EnumSet
is that readability, usability and safety is increased, because the
EnumSet
type explicitely specifies which kind of enumrators expect. But to have this, you pay something in performances (nothing is fastest than using simple `Int`s)
since I had to deal a lot with that, I'm used to have a couple of additional functions with enums to easier the job
d
Not just a couple!!! Tons! ­čś« I guess I got the right person for this ­čÖé