我有以下代码,在视图中需要显示列表的元素,然后将这些项从列表中删除。我一直在研究 Kotlin 中的 filter 与 map,但没有找到解决方案。
var mutableList: MutableList<Object> = myImmutableList.toMutableList()
for (x in mutableList.indices)
{
val tile = row!!.getChildAt(x % 4)
val label = tile.findViewById(android.R.id.text1) as TextView
label.text = mutableList[x].name
val icon = tile.findViewById(android.R.id.icon) as ImageView
picasso.load(mutableList[x].icon).into(icon)
}