我将共享首选项值存储为HashSet,在检索时,我看到有关未检查的强制转换的警告。什么是最简单的,什么是最安全的解决方案,以确保在这里没有bug的实现? class TaskListDataManager(private val context: Context) { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context).edit()
sharedPreferences.putS
String):T = ...我想从字符串模板调用该函数,如下所示:val v:String = "value of key is: ${c["key"]}"Error:(26, 19) Kotlin: Type inference failed: Not enough information to val c = Config()
val s:String = c[