https://kotlinlang.org logo
#announcements
Title
# announcements
v

ValV

06/21/2019, 5:22 AM
Another obscure thing for me, why is this kind of mapping not possible?
Copy code
fun main() {
    val a = listOf(listOf(32,53,23), listOf(13), listOf(34))
    val its = a.map(it.iterator())
    println(its)
}
map(it.iterator())
l

louis993546

06/21/2019, 5:25 AM
a.map { it.iterator() }
👍 1
v

ValV

06/21/2019, 5:27 AM
🙂 Thanks. I've not been using Kotlin for few month and totaly forgot
Forgot that lambdas are passed without braces
g

gildor

06/21/2019, 5:49 AM
It would be much easier with IDE help
Easy to identify what is required and is not working
v

ValV

06/21/2019, 6:33 AM
Yep, I saw this thing, but could not understand at once, 'cause it doesn't say explicitly, that I should replace
( )
with
{ }
. Just forgot Kotlin synax 🤷‍♂️
g

gildor

06/21/2019, 6:37 AM
it says that
it
doesn’t exist and that type param is actually lambda
2 Views