如何在Java中从Java列表中创建scala.collection.immutable.Seq?
我试图让Akka进入我的Java项目,我挂在Scala的Seq类型的一个小问题上。我能够将我的Java List of ActorRef转换为scala.collection.Seq,但是我尝试使用的Akka API需要scala.collection.immutable.Seq。我怎样才能做一个?
法典:
static class Router extends UntypedLoadBalancer {
private final InfiniteIterator<ActorRef> workers;
public Router(List<ActorRef> workers) {
Seq workerSeq = asScalaBuffer(workers);
// how to get from the scala.collection.Seq above to the instance of
// scala.collection.immutable.Seq required by CyclicIterator below?
this.workers = new CyclicIterator<ActorRef>();
}
public InfiniteIterator<ActorRef> seq() {
return workers;
}
}