object ImplicitConversions extends ToScalaImplicits with ToJavaImplicits
Convenience for miscellaneous implicit conversions between Java and Scala collections API.
It is recommended to use explicit conversions provided by collection.JavaConverters instead. Implicit conversions may cause unexpected issues. Example:
import collection.convert.ImplicitConversions._ case class StringBox(s: String) val m = Map(StringBox("one") -> "uno") m.get("one")
The above example returns null
instead of producing a type error at compile-time. The map is
implicitly converted to a java.util.Map
which provides a method get(x: AnyRef)
.
- Alphabetic
- By Inheritance
- ImplicitConversions
- ToJavaImplicits
- ToScalaImplicits
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
implicit
def
buffer AsJavaList[A](b: Buffer[A]): java.util.List[A]
Implicitly converts a Scala mutable
Buffer
to a JavaList
.Implicitly converts a Scala mutable
Buffer
to a JavaList
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
collection AsScalaIterable[A](i: Collection[A]): Iterable[A]
Implicitly converts a Java
Collection
to an ScalaIterable
.Implicitly converts a Java
Collection
to an ScalaIterable
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
collection asJava[A](it: Iterable[A]): Collection[A]
Implicitly converts a Scala
Iterable
to an immutable JavaCollection
.Implicitly converts a Scala
Iterable
to an immutable JavaCollection
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
dictionary AsScalaMap[A, B](p: Dictionary[A, B]): mutable.Map[A, B]
Implicitly converts a Java
Dictionary
to a Scala mutableMap
.Implicitly converts a Java
Dictionary
to a Scala mutableMap
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
dictionary asJava[A, B](m: mutable.Map[A, B]): Dictionary[A, B]
Implicitly converts a Scala mutable
Map
to a JavaDictionary
.Implicitly converts a Scala mutable
Map
to a JavaDictionary
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
enumeration AsScalaIterator[A](i: java.util.Enumeration[A]): Iterator[A]
Implicitly converts a Java
Enumeration
to a ScalaIterator
.Implicitly converts a Java
Enumeration
to a ScalaIterator
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
enumeration asJava[A](it: Iterator[A]): java.util.Enumeration[A]
Implicitly converts a Scala
Iterator
to a JavaEnumeration
.Implicitly converts a Scala
Iterator
to a JavaEnumeration
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
iterable AsScalaIterable[A](i: java.lang.Iterable[A]): Iterable[A]
Implicitly converts a Java
Iterable
to a ScalaIterable
.Implicitly converts a Java
Iterable
to a ScalaIterable
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
iterable asJava[A](i: Iterable[A]): java.lang.Iterable[A]
Implicitly converts a Scala
Iterable
to a JavaIterable
.Implicitly converts a Scala
Iterable
to a JavaIterable
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
iterator asJava[A](it: Iterator[A]): java.util.Iterator[A]
Implicitly converts a Scala
Iterator
to a JavaIterator
.Implicitly converts a Scala
Iterator
to a JavaIterator
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
iterator asScala[A](it: java.util.Iterator[A]): Iterator[A]
Implicitly converts a Java
Iterator
to a ScalaIterator
.Implicitly converts a Java
Iterator
to a ScalaIterator
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
list asScalaBuffer[A](l: java.util.List[A]): Buffer[A]
Implicitly converts a Java
List
to a Scala mutableBuffer
.Implicitly converts a Java
List
to a Scala mutableBuffer
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
map AsJavaConcurrentMap[A, B](m: concurrent.Map[A, B]): ConcurrentMap[A, B]
Implicitly converts a Scala mutable
concurrent.Map
to a JavaConcurrentMap
.Implicitly converts a Scala mutable
concurrent.Map
to a JavaConcurrentMap
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
map AsJavaMap[A, B](m: Map[A, B]): java.util.Map[A, B]
Implicitly converts a Scala
Map
to a JavaMap
.Implicitly converts a Scala
Map
to a JavaMap
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
map AsScala[A, B](m: java.util.Map[A, B]): mutable.Map[A, B]
Implicitly converts a Java
Map
to a Scala mutableMap
.Implicitly converts a Java
Map
to a Scala mutableMap
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
map AsScalaConcurrentMap[A, B](m: ConcurrentMap[A, B]): concurrent.Map[A, B]
Implicitly converts a Java
ConcurrentMap
to a Scala mutableConcurrentMap
.Implicitly converts a Java
ConcurrentMap
to a Scala mutableConcurrentMap
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
mutableMap AsJavaMap[A, B](m: mutable.Map[A, B]): java.util.Map[A, B]
Implicitly converts a Scala mutable
Map
to a JavaMap
.Implicitly converts a Scala mutable
Map
to a JavaMap
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
mutableSeq AsJavaList[A](seq: mutable.Seq[A]): java.util.List[A]
Implicitly converts a Scala mutable
Seq
to a JavaList
.Implicitly converts a Scala mutable
Seq
to a JavaList
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
mutableSet AsJavaSet[A](s: mutable.Set[A]): java.util.Set[A]
Implicitly converts a Scala mutable
Set
to a JavaSet
.Implicitly converts a Scala mutable
Set
to a JavaSet
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
properties AsScalaMap(p: Properties): mutable.Map[String, String]
Implicitly converts a Java
Properties
to a Scalamutable Map[String, String]
.Implicitly converts a Java
Properties
to a Scalamutable Map[String, String]
.- Definition Classes
- ToScalaImplicits
- See also
-
implicit
def
seq AsJavaList[A](seq: Seq[A]): java.util.List[A]
Implicitly converts a Scala
Seq
to a JavaList
.Implicitly converts a Scala
Seq
to a JavaList
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
set AsJavaSet[A](s: Set[A]): java.util.Set[A]
Implicitly converts a Scala
Set
to a JavaSet
.Implicitly converts a Scala
Set
to a JavaSet
.- Definition Classes
- ToJavaImplicits
- See also
-
implicit
def
set asScala[A](s: java.util.Set[A]): mutable.Set[A]
Implicitly converts a Java
Set
to a Scala mutableSet
.Implicitly converts a Java
Set
to a Scala mutableSet
.- Definition Classes
- ToScalaImplicits
- See also
This is the documentation for the Scala standard library.
Package structure
The scala package contains core types like
Int
,Float
,Array
orOption
which are accessible in all Scala compilation units without explicit qualification or imports.Notable packages include:
scala.collection
and its sub-packages contain Scala's collections frameworkscala.collection.immutable
- Immutable, sequential data-structures such asVector
,List
,Range
,HashMap
orHashSet
scala.collection.mutable
- Mutable, sequential data-structures such asArrayBuffer
,StringBuilder
,HashMap
orHashSet
scala.collection.concurrent
- Mutable, concurrent data-structures such asTrieMap
scala.collection.parallel.immutable
- Immutable, parallel data-structures such asParVector
,ParRange
,ParHashMap
orParHashSet
scala.collection.parallel.mutable
- Mutable, parallel data-structures such asParArray
,ParHashMap
,ParTrieMap
orParHashSet
scala.concurrent
- Primitives for concurrent programming such asFutures
andPromises
scala.io
- Input and output operationsscala.math
- Basic math functions and additional numeric types likeBigInt
andBigDecimal
scala.sys
- Interaction with other processes and the operating systemscala.util.matching
- Regular expressionsOther packages exist. See the complete list on the right.
Additional parts of the standard library are shipped as separate libraries. These include:
scala.reflect
- Scala's reflection API (scala-reflect.jar)scala.xml
- XML parsing, manipulation, and serialization (scala-xml.jar)scala.swing
- A convenient wrapper around Java's GUI framework called Swing (scala-swing.jar)scala.util.parsing
- Parser combinators (scala-parser-combinators.jar)Automatic imports
Identifiers in the scala package and the
scala.Predef
object are always in scope by default.Some of these identifiers are type aliases provided as shortcuts to commonly used classes. For example,
List
is an alias forscala.collection.immutable.List
.Other aliases refer to classes provided by the underlying platform. For example, on the JVM,
String
is an alias forjava.lang.String
.