What is the correct way to create a thread-safe, infinite circular iterator in scala? It seems that the following is not thread safe (iterating simulataneously from multiple threads on iterator occasionally throws exceptions):
val map = Map(1->"one", 2->"two")
val iterator = Iterator.continually(map).flatten
How would you correct this to make it thread-safe?