How to limit the type instead of using Any in value of map?
val mixType = Map<String, String or Boolean or Int>() // something I like
val anyType = Map<String, Any>() // the scope is too large
How to limit the type instead of using Any in value of map?
val mixType = Map<String, String or Boolean or Int>() // something I like
val anyType = Map<String, Any>() // the scope is too large
I would suggest using a sealed class here:
sealed class MyValue {
class IntValue(val value: Int): MyValue()
class BooleanValue(val value: String): MyValue()
class StringValue(val value: Boolean): MyValue()
}