Join Slack
Powered by
if I know that this Enum extends also a specific i...
# announcements
e
elect
02/15/2019, 9:19 AM
if I know that this Enum extends also a specific interface, is there a way to express it in its type?
val values: Array<out Enum<*>> = Enum::class.java.enumConstants
d
Dominaezzz
02/15/2019, 12:12 PM
Might be better off making an Array of the interface.
e
elect
02/15/2019, 1:09 PM
you mean casting?
d
Dominaezzz
02/15/2019, 1:11 PM
yes
k
karelpeeters
02/15/2019, 1:12 PM
If you're working with generics it's possible to express intersection types, but in general not.
e
elect
02/15/2019, 1:13 PM
ok
3
Views
Open in Slack
Previous
Next