在Kotlin中,如果要使用forEach
的元素,可以使用it
关键字.所以现在我想知道,如果我有一个forEach
中的forEach
,我该怎么办:
list.forEach {
val parent = it
it.forEach {
// `it` now become the element of the parent.
}
}
I think that defines a new variable only for the naming convention be so stupid. Have any other solution for this problem?