is there a `java.util.EnumSet` equivalent in Kotli...
# getting-started
h
is there a
java.util.EnumSet
equivalent in Kotlin? If not (how) can I use it with a Kotlin
enum class
?
e
just use
java.util.EnumSet
. It works fine with Kotlin’s
enum class
.
h
Great, thanks. I didn't get the syntax right though 😅
Copy code
enum class AnEnum { ONE, TWO, THREE, FOUR }
val x = EnumSet.allOf(AnEnum::class)
This does not compile, how would I do it?
j
@horse_badorties
EnumSet.allOf(AnEnum::class.java)
h
thanks 👍
637 Views