How to create a scala.collection.immutable.Seq from a Java List in Java?
The akka Java documentation for routers as well as the ScalaDoc for CyclicIterator both suggest that the CyclicIterator constructor takes a List.
You can use scala.collection.JavaConversions.asScalaBuffer
to convert the Java List
to a Scala Buffer
, which has a toList
method, and a Scala List
is a collection.immutable.Seq
.
You can try this:
scala.collection.JavaConverters.asScalaIteratorConverter(list.iterator()).asScala().toSeq();