所以我得到了这段代码,但不知何故“添加”功能不起作用。“许可”列表没问题,if-case 也被触发。但是最后一个“日志”仍然显示许可调制的“空”。任何想法?
val permits: List<Schueler> = gson.fromJson(body, Array<Schueler>::class.java).toList()
val permits_modulated: MutableList<Schueler>? = null
for (permit in permits) {
Log.d("permit in permits", permit.toString() + " " + permit.vorname)
if (permit.vorname == name) {
permits_modulated?.add(permit)
Log.d("permit.vorname == name", permit.toString() + " " + permit.vorname)
Log.d("permit_modulated in if", permits_modulated.toString())
}
}