I have a collection of ints that repeat themselves in a pattern:
val repeatingSequence = List(1,2,3,1,2,3,4,1,2,1,2,3,4,5)
I\'d like to sec
Given an iterator itr, this will do the trick:
itr
val head = iter.next() val out = ( Iterator continually {iter takeWhile (_ != head)} takeWhile {!_.isEmpty} map {head :: _.toList} ).toList