Is there a more elegant method than going through a Seq
?
val origin = Set("a", "b")
val intermediate = origin.toSeq
val stream = Stream.from(0).map { index =>
intermediate(index % intermediate.size)
}.toIterator
stream.next() // => "a"
stream.next() // => "b"
stream.next() // => "a"
I am specifically targeting Scala 2.9.