Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- iter: Iterator[Int] = non-empty iterator
- firstTwoElements: List[(Int, Int)] = List((1,0), (2,1))
- x: List[Int] = List(4, 5, 6, 7, 8, 9)
Add Comment
Please, Sign In to add comment