Guest User

Untitled

a guest
Feb 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. scala> val iter = List(1, 2, 3, 4, 5, 6, 7, 8, 9).elements; val firstTwoElements = iter.zipWithIndex.takeWhile(_._2 < 2).toList; val x = iter.toList
  2. iter: Iterator[Int] = non-empty iterator
  3. firstTwoElements: List[(Int, Int)] = List((1,0), (2,1))
  4. x: List[Int] = List(4, 5, 6, 7, 8, 9)
Add Comment
Please, Sign In to add comment