are there any built in sealed classes that accepts...
# announcements
w
are there any built in sealed classes that accepts any primitive?
im looking to create a map of string to a "primitive" and its rather gross to create my own sealed class and have wrapper objects for those primitve types
k
Not as far as I know, probably because Kotlin tries to avoid the concept of a primitive as much as possible, that's why there's no
int
vs
Integer
.
w
yeah i knew that was a thing just too bad i'll have to wrap it then
g
Sealed class for any primitives? How should it work? There is no common type for all primitives, you can create own sealed class that wraps them all, but looks as too specific use case for me to be in stdlib
And even in theory on JVM you cannot create generic collection for multiple primitive types, it will be boxed in any case. Tho collection itself maybe a generic of some other type, for example sealed class which contains field with primitive generic
w
i assumed so but figured i would ask