scala.collection

JavaConversions

object JavaConversions extends AnyRef

A collection of implicit conversions supporting interoperability between Scala and Java collections.

The following conversions are supported:

In all cases, converting from a source type to a target type and back again will return the original source object, eg.

   import scala.collection.JavaConversions._

val sl = new scala.collection.mutable.ListBuffer[Int] val jl : java.util.List[Int] = sl val sl2 : scala.collection.mutable.Buffer[Int] = jl assert(sl eq sl2)g

Note that no conversion is provided from scala.collection.immutable.List to java.util.List. Instead it is convertible to an immutable java.util.Collection which provides size and interation capabilities, but not access by index as would be provided by java.util.List.
This is intentional: in combination the implementation of scala.collection.immutable.List and the typical usage patterns of java.util.List would perform extremely poorly.

Inherits

  1. AnyRef
  2. Any

Type Members

  1. class IterableWrapper[A](underlying: Iterable[A]) extends AbstractCollection[A] with Product

  2. class IteratorWrapper[A](underlying: Iterator[A]) extends Iterator[A] with Enumeration[A] with Product

  3. class JCollectionWrapper[A](underlying: Collection[A]) extends Iterable[A] with Product

  4. class JEnumerationWrapper[A](underlying: Enumeration[A]) extends Iterator[A] with Product

  5. class JIterableWrapper[A](underlying: Iterable[A]) extends Iterable[A] with Product

  6. class JIteratorWrapper[A](underlying: Iterator[A]) extends Iterator[A] with Product

  7. class JListWrapper[A](underlying: List[A]) extends Buffer[A] with Product

  8. class JMapWrapper[A, B](underlying: Map[A, B]) extends Map[A, B] with MapLike[A, B, JMapWrapper[A, B]] with Product

  9. class JSetWrapper[A](underlying: Set[A]) extends Set[A] with SetLike[A, JSetWrapper[A]] with Product

  10. class MutableBufferWrapper[A](underlying: Buffer[A]) extends AbstractList[A] with Product

  11. class MutableMapWrapper[A, B](underlying: Map[A, B])(m: ClassManifest[A]) extends AbstractMap[A, B] with Product

  12. class MutableSetWrapper[A](underlying: Set[A])(m: ClassManifest[A]) extends AbstractSet[A] with Product

Value Members

  1. def asBuffer[A](l: List[A]): Buffer[A]

    Implicitly converts a Java List to a Scala mutable Buffer

  2. def asCollection[A](i: Iterable[A]): Collection[A]

    Implicitly converts a Scala Iterable to an immutable Java Collection

  3. def asEnumeration[A](i: Iterator[A]): Enumeration[A]

    Implicitly converts a Scala Iterator to a Java Enumeration

  4. def asIterable[A](i: Collection[A]): Iterable[A]

    Implicitly converts a Java Collection to an Scala Iterable

  5. def asIterable[A](i: Iterable[A]): Iterable[A]

    Implicitly converts a Java Iterable to a Scala Iterable

  6. def asIterable[A](i: Iterable[A]): Iterable[A]

    Implicitly converts a Scala Iterable to a Java Iterable

  7. def asIterator[A](i: Enumeration[A]): Iterator[A]

    Implicitly converts a Java Enumeration to a Scala Iterator

  8. def asIterator[A](i: Iterator[A]): Iterator[A]

    Implicitly converts a Java Iterator to a Scala Iterator

  9. def asIterator[A](i: Iterator[A]): Iterator[A]

    Implicitly converts a Scala Iterator to a Java Iterator

  10. def asList[A](b: Buffer[A]): List[A]

    Implicitly converts a Scala mutable Buffer to a Java List

  11. def asMap[A, B](m: Map[A, B]): Map[A, B]

    Implicitly converts a Java Map to a Scala mutable Map

  12. def asMap[A, B](m: Map[A, B])(ma: ClassManifest[A]): Map[A, B]

    Implicitly converts a Scala mutable Map to a Java Map

  13. def asSet[A](s: Set[A]): Set[A]

    Implicitly converts a Java Set to a Scala mutable Set

  14. def asSet[A](s: Set[A])(m: ClassManifest[A]): Set[A]

    Implicitly converts a Scala mutable Set to a Java Set

  15. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

  16. def hashCode(): Int

    Returns a hash code value for the object

  17. def toString(): String

    Returns a string representation of the object