Scala Language Java Interoperability Scala and Java type conversions


Example

Scala offers implicit conversions between all the major collection types in the JavaConverters object.

The following type conversions are bidirectional.

Scala TypeJava Type
Iteratorjava.util.Iterator
Iteratorjava.util.Enumeration
Iteratorjava.util.Iterable
Iteratorjava.util.Collection
mutable.Bufferjava.util.List
mutable.Setjava.util.Set
mutable.Mapjava.util.Map
mutable.ConcurrentMapjava.util.concurrent.ConcurrentMap

Certain other Scala collections can also be converted to Java, but do not have a conversion back to the original Scala type:

Scala TypeJava Type
Seqjava.util.List
mutable.Seqjava.util.List
Setjava.util.Set
Mapjava.util.Map

Reference:

Conversions Between Java and Scala Collections