[英]How to covert Scala Seq to Java Enumeration
我想将scala Seq
转换为Java java.util.Enumeration
任何提示?
In case someone else is interested in the answer: 如果其他人对答案感兴趣:
By importing scala.collection.JavaConversions
I could use asJavaEnumeration[A](i: Iterator[A]): Enumeration[A]
to do the job. 通过导入
scala.collection.JavaConversions
我可以使用asJavaEnumeration[A](i: Iterator[A]): Enumeration[A]
来完成这项工作。
Enumeration
is basically an outdated thing. Enumeration
基本上是过时的事情。 It is one of those concepts that were introduced with Java 1.0, but that nobody would / should be using any more nowadays. 它是Java 1.0引入的那些概念之一,但如今没有人会/应该再使用。
In 2017, you use collections . 在2017年,您将使用collections 。 In other words: if at all, you turn your
Seq
into a List
. 换句话说:如果有的话,您可以将
Seq
变成List
。 You can read about how to do that here . 您可以在此处阅读有关操作方法的信息 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.