'What's Kotlin equivalent of Class<?>
I want a map between Int and any class. In Java it would be Map<Class<?>, Integer>. What's the Kotlin equivalent of that?
Solution 1:[1]
The equivalent declaration would be Map<Class<*>, Int>.
Solution 2:[2]
You're looking for KClass. You need to add the Kotlin reflection library in order to use it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Elforama |
