onEach

The onEach function evaluates each element of the list and returns the original list afterward: 

println("Get original list back and print square of each element")
var newNumbers = numbers.onEach{ println(it * it)}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.240.252