Guest User

Untitled

a guest
May 25th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. val fruits = arrayOf("Orange", "Apple", "Plum", "Medlar", "Durian", "Strawberry", "Tangerine", "Clementine")
  2.  
  3. println(fruits.take(3)) // ["Orange", "Apple", "Plum"]
  4.  
  5. println(fruits.takeWhile { it.endsWith("e") }) // ["Orange", "Apple"]
  6.  
  7. println(fruits.takeLast(3)) // ["Strawberry", "Tangerine", "Clementine"]
  8.  
  9. println(fruits.takeLastWhile { it.endsWith("e") }) // ["Clementine"]
Add Comment
Please, Sign In to add comment