dropWhile

The dropWhile function accepts a lambda expression. This function keeps ignoring the elements until the condition is satisfied and returns a new list as a result:

newList = numbers.dropWhile { it < 5 }
println("Drop from beginning : while element is less than 5")
println(newList)
..................Content has been hidden....................

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