我想将可变映射转换为Any对象。例如:
Val map = mutableMapOf("name" to "michael", "age" to "12")
Var user = map.toObject //Any Object i want
And :
Print((user as User).name)
//output michael
Print((user as User).age)
//output 12
Class User(val name, val age){
}
因为我正在创建一个泛型函数。用什么方式?