Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert from java.util.Vector to a scala Seq

I can see that there are ways to convert from a Java list to a Scala seq (using asScala method) but I could not find any converters for java.util.Vector.

Is there a similar way for this conversion too?

like image 562
Harshal Pandya Avatar asked Jul 10 '12 20:07

Harshal Pandya


1 Answers

JavaConverters is a bit more idiomatic than JavaConversions.

import collection.JavaConverters._

val v = new java.util.Vector[Int]
val s: Seq[Int] = v.asScala
like image 133
missingfaktor Avatar answered Sep 21 '22 05:09

missingfaktor