No description or website provided.
Scala Shell
Failed to load latest commit information.
src Implement equals, hashCode, toString in LinearSeqWrapper Jul 13, 2013
.gitignore 1.6 release with support for scala 2.11 Feb 13, 2015
LICENSE License, Dictionary support, documentation Mar 22, 2010
ReleaseChecklist.txt Add release checklist Jul 11, 2013
build.sbt 1.7-SNAPSHOT Feb 13, 2015
sbt 1.6 release with support for scala 2.11 Feb 13, 2015


A library for converting between Java and Scala collections.


Turn any Scala collection into the corresponding Java collection:

import scalaj.collection.Imports._

List(1, 2, 3).asJava
// returns java.util.List[java.lang.Integer]

Map(1 -> "a", 2 -> "b", 3 -> "c").asJava
// returns java.util.Map[java.lang.Integer, java.lang.String]

Set(1, 2, 3).asJava
// returns java.util.Set[java.lang.Integer]

Turn any Java collection into the corresponding Scala collection:

val list = new java.util.ArrayList[java.lang.Integer]
// returns scala.Seq[Int]

As shown in the above examples, the library also converts between the boxed types of Scala and Java primitives.

You can also use foreach on any Java collection:

// prints "123"

The map, filter, and flatMap methods are still pending.


scalaj-collection requires Scala 2.9.x, 2.10.x or 2.11.x



If you're using sbt, simply add the following line to your project file:

libraryDependencies += "org.scalaj" %% "scalaj-collection" % "1.6"


If you're using Maven, add the following to your pom.xml:



Download the jars from

From source

Clone the repository from Github:

git clone git://

Build the project and create the JAR (requires sbt version 0.12.4 or greater):

cd scalaj-collection
sbt package


The following methods are added via the Swag My Library pattern:

// Java to Scala
java.lang.Comparable[A]   #asScala: scala.math.Ordered[A]
java.util.Comparator[A]   #asScala: scala.math.Ordering[A]
java.util.Enumeration[A]  #asScala: scala.collection.Iterator[A]
                          #foreach(A => Unit): Unit
java.util.Iterator[A]     #asScala: scala.collection.Iterator[A]
                          #foreach(A => Unit): Unit
java.lang.Iterable[A]     #asScala: scala.collection.Iterable[A]
                          #foreach(A => Unit): Unit
java.util.List[A]         #asScala: scala.collection.Seq[A]
                          #asScalaMutable: scala.collection.mutable.Seq[A]
java.util.Set[A]          #asScala: scala.collection.Set[A]
                          #asScalaMutable: scala.collection.mutable.Set[A]
java.util.Map[A, B]       #asScala: scala.collection.Map[A, B]
                          #asScalaMutable: scala.collection.mutable.Map[A, B]
                          #foreach(((A, B)) => Unit): Unit
java.util.Dictionary[A, B]#asScala: scala.collection.mutable.Map[A, B]
                          #foreach(((A, B)) => Unit): Unit

// Scala to Java
scala.math.Ordered[A]             #asJava: java.util.Comparable[A]
scala.math.Ordering[A]            #asJava: java.util.Comparator[A]
scala.collection.Iterator[A]      #asJava: java.util.Iterator[A]
                                  #asJavaEnumeration: java.util.Enumeration[A]
scala.collection.Iterable[A]      #asJava: java.lang.Iterable[A]
scala.collection.Seq[A]           #asJava: java.util.List[A]
scala.collection.mutable.Seq[A]   #asJava: java.util.List[A]
scala.collection.mutable.Buffer[A]#asJava: java.util.List[A]
scala.collection.Set[A]           #asJava: java.util.Set[A]
scala.collection.mutable.Set[A]   #asJava: java.util.Set[A]
scala.collection.Map[A, B]        #asJava: java.util.Map[A, B]
scala.collection.mutable.Map[A, B]#asJava: java.util.Map[A, B]
                                  #asJavaDictionary: java.util.Dictionary[A, B]