scala.collection (original) (raw)

An extractor used to head/tail deconstruct sequences.

An extractor used to head/tail deconstruct sequences.

Attributes

Source

package.scala

Supertypes

Self type

An extractor used to init/last deconstruct sequences.

An extractor used to init/last deconstruct sequences.

Attributes

Source

package.scala

Supertypes

Self type

Explicit instantiation of the IndexedSeqView trait to reduce class file size in subclasses.

Explicit instantiation of the IndexedSeqView trait to reduce class file size in subclasses.

Attributes

Source

IndexedSeqView.scala

Supertypes

Known subtypes

Explicit instantiation of the Iterable trait to reduce class file size in subclasses.

Explicit instantiation of the Iterable trait to reduce class file size in subclasses.

Attributes

Source

Iterable.scala

Supertypes

Known subtypes

class ::[A]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

Show all

Explicit instantiation of the Iterator trait to reduce class file size in subclasses.

Explicit instantiation of the Iterator trait to reduce class file size in subclasses.

Attributes

Source

Iterator.scala

Supertypes

Known subtypes

Explicit instantiation of the Map trait to reduce class file size in subclasses.

Explicit instantiation of the Map trait to reduce class file size in subclasses.

Attributes

Source

Map.scala

Supertypes

trait Map[K, V]

trait K => V

Show all

Known subtypes

Explicit instantiation of the MapView trait to reduce class file size in subclasses.

Explicit instantiation of the MapView trait to reduce class file size in subclasses.

Attributes

Source

MapView.scala

Supertypes

trait MapOps[K, V, { type l = [X, Y] =>> View[(X, Y)]; }#, View[(K, V)]]

trait K => V

trait View[(K, V)]

Show all

Known subtypes

Explicit instantiation of the Seq trait to reduce class file size in subclasses.

Explicit instantiation of the Seq trait to reduce class file size in subclasses.

Attributes

Source

Seq.scala

Supertypes

Known subtypes

Explicit instantiation of the SeqView trait to reduce class file size in subclasses.

Explicit instantiation of the SeqView trait to reduce class file size in subclasses.

Attributes

Source

SeqView.scala

Supertypes

Known subtypes

class Id[A]

class Id[A]

Show all

Explicit instantiation of the Set trait to reduce class file size in subclasses.

Explicit instantiation of the Set trait to reduce class file size in subclasses.

Attributes

Source

Set.scala

Supertypes

Known subtypes

Explicit instantiation of the View trait to reduce class file size in subclasses.

Explicit instantiation of the View trait to reduce class file size in subclasses.

Attributes

Source

View.scala

Supertypes

Known subtypes

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

Show all

A Stepper for arbitrary element types.

This class serves as a wrapper for Arrays with many of the operations found in indexed sequences.

This class serves as a wrapper for Arrays with many of the operations found in indexed sequences. Where needed, instances of arrays are implicitly converted into this class. There is generally no reason to create an instance explicitly or use an ArrayOps type. It is better to work with plain Array types instead and rely on the implicit conversion to ArrayOps when calling a method (which does not actually allocate an instance of ArrayOps because it is a value class).

Neither Array nor ArrayOps are proper collection types (i.e. they do not extend Iterable or even IterableOnce). mutable.ArraySeq and immutable.ArraySeq serve this purpose.

The difference between this class and ArraySeqs is that calling transformer methods such as filter and map will yield an array, whereas an ArraySeq will remain an ArraySeq.

Type parameters

A

type of the elements contained in this array.

Attributes

Companion

object

Source

ArrayOps.scala

Supertypes

Base type of bitsets.

Base type of bitsets.

This trait provides most of the operations of a BitSet independently of its representation. It is inherited by all concrete implementations of bitsets.

Attributes

Companion

object

Source

BitSet.scala

Supertypes

Known subtypes

Base implementation type of bitsets

Base implementation type of bitsets

Attributes

Companion

object

Source

BitSet.scala

Supertypes

Known subtypes

Self type

Buffered iterators are iterators which provide a method head that inspects the next element without discarding it.

Buffered iterators are iterators which provide a method head that inspects the next element without discarding it.

Attributes

Source

BufferedIterator.scala

Supertypes

Builds a collection of type C from elements of type A when a source collection of type From is available.

Builds a collection of type C from elements of type A when a source collection of type From is available. Implicit instances of BuildFrom are available for all collection types.

Type parameters

A

Type of elements (e.g. Int, Boolean, etc.)

C

Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)

From

Type of source collection

Attributes

Companion

object

Source

BuildFrom.scala

Supertypes

Self type

Base trait for companion objects of collections that require an implicit ClassTag.

Base trait for companion objects of collections that require an implicit ClassTag.

Type parameters

CC

Collection type constructor (e.g. ArraySeq)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

Type parameters

CC

Collection type constructor (e.g. ArraySeq)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

Base trait for companion objects of collections that require an implicit evidence.

Base trait for companion objects of collections that require an implicit evidence.

Type parameters

CC

Collection type constructor (e.g. ArraySeq)

Ev

Unary type constructor for the implicit evidence required for an element type (typically Ordering or ClassTag)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for collections that have an additional constraint, expressed by the evidenceIterableFactory method.

The default implementations in this trait can be used in the common case when CC[A] is the same as C.

Attributes

Source

Iterable.scala

Supertypes

Known subtypes

A factory that builds a collection of type C with elements of type A.

Type parameters

A

Type of elements (e.g. Int, Boolean, etc.)

C

Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

Base trait for indexed sequences that have efficient apply and length

Base trait for indexed sequences that have efficient apply and length

Attributes

Companion

object

Source

IndexedSeq.scala

Supertypes

Known subtypes

Base trait for indexed Seq operations

Base trait for indexed Seq operations

Attributes

Source

IndexedSeq.scala

Supertypes

Known subtypes

class Id[A]

class Map[A, B]

Show all

Self type

View defined in terms of indexing a range

View defined in terms of indexing a range

Attributes

Companion

object

Source

IndexedSeqView.scala

Supertypes

Known subtypes

class Id[A]

class Map[A, B]

Show all

Self type

Base trait for generic collections.

Base trait for generic collections.

Type parameters

A

the element type of the collection

Attributes

Companion

object

Source

Iterable.scala

Supertypes

Known subtypes

trait Map[K, V]

class ::[A]

trait Map[K, V]

trait Map[K, V]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

trait Map[K, V]

Show all

Base trait for companion objects of unconstrained collection types that may require multiple traversals of a source collection to build a target collection CC.

Base trait for companion objects of unconstrained collection types that may require multiple traversals of a source collection to build a target collection CC.

Type parameters

CC

Collection type constructor (e.g. List)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

The default implementations in this trait can be used in the common case when CC[A] is the same as C.

Attributes

Source

Iterable.scala

Supertypes

Known subtypes

trait Map[K, V]

class ::[A]

trait Map[K, V]

trait Map[K, V]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

trait Map[K, V]

Show all

A template trait for collections which can be traversed either once only or one or more times.

A template trait for collections which can be traversed either once only or one or more times.

Note: IterableOnce does not extend IterableOnceOps. This is different than the general design of the collections library, which uses the following pattern:

trait Seq extends Iterable with SeqOps
trait SeqOps extends IterableOps

trait IndexedSeq extends Seq with IndexedSeqOps
trait IndexedSeqOps extends SeqOps

The goal is to provide a minimal interface without any sequential operations. This allows third-party extension like Scala parallel collections to integrate at the level of IterableOnce without inheriting unwanted implementations.

Attributes

Companion

object

Source

IterableOnce.scala

Supertypes

Known subtypes

trait Map[K, V]

class ::[A]

trait Map[K, V]

trait Map[K, V]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

trait Map[K, V]

trait MapOps[K, V, CC, C]

trait MapOps[K, V, CC, C]

trait MapOps[K, V, CC, C]

Show all

This implementation trait can be mixed into an IterableOnce to get the basic methods that are shared between Iterator and Iterable.

This implementation trait can be mixed into an IterableOnce to get the basic methods that are shared between Iterator and Iterable. The IterableOnce must support multiple calls to iterator but may or may not return the same Iterator every time.

Attributes

Source

IterableOnce.scala

Supertypes

Known subtypes

trait Map[K, V]

class ::[A]

trait MapOps[K, V, CC, C]

trait Map[K, V]

trait Map[K, V]

trait MapOps[K, V, CC, C]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

trait Map[K, V]

trait MapOps[K, V, CC, C]

Show all

Self type

Base trait for Iterable operations

Base trait for Iterable operations

VarianceNote

We require that for all child classes of Iterable the variance of the child class and the variance of the C parameter passed to IterableOps are the same. We cannot express this since we lack variance polymorphism. That's why we have to resort at some places to write C[A @uncheckedVariance].

Type parameters

C

type of the collection (e.g. List[Int], String, BitSet). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.

CC

type constructor of the collection (e.g. List, Set). Operations returning a collection with a different type of element B (e.g. map) return a CC[B].

Attributes

Companion

object

Source

Iterable.scala

Supertypes

Known subtypes

trait Map[K, V]

class ::[A]

trait MapOps[K, V, CC, C]

trait Map[K, V]

trait Map[K, V]

trait MapOps[K, V, CC, C]

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

trait Map[K, V]

trait MapOps[K, V, CC, C]

Show all

Iterators are data structures that allow to iterate over a sequence of elements.

Iterators are data structures that allow to iterate over a sequence of elements. They have a hasNext method for checking if there is a next element available, and a next method which returns the next element and advances the iterator.

An iterator is mutable: most operations on it change its state. While it is often used to iterate through the elements of a collection, it can also be used without being backed by any collection (see constructors on the companion object).

It is of particular importance to note that, unless stated otherwise, one should never use an iterator after calling a method on it. The two most important exceptions are also the sole abstract methods: next and hasNext.

Both these methods can be called any number of times without having to discard the iterator. Note that even hasNext may cause mutation -- such as when iterating from an input stream, where it will block until the stream is closed or some input becomes available.

Consider this example for safe and unsafe use:

def f[A](it: Iterator[A]) = {
 if (it.hasNext) {            // Safe to reuse "it" after "hasNext"
   it.next()                  // Safe to reuse "it" after "next"
   val remainder = it.drop(2) // it is *not* safe to use "it" again after this line!
   remainder.take(2)          // it is *not* safe to use "remainder" after this line!
 } else it
}

Attributes

Companion

object

Source

Iterator.scala

Supertypes

Known subtypes

Self type

Decorator representing lazily zipped pairs.

Decorator representing lazily zipped triples.

Decorator representing lazily zipped 4-tuples.

Base trait for linearly accessed sequences that have efficient head and tail operations.

Base trait for linearly accessed sequences that have efficient head and tail operations. Known subclasses: List, LazyList

Attributes

Companion

object

Source

LinearSeq.scala

Supertypes

Known subtypes

Base trait for linear Seq operations

Base trait for linear Seq operations

Attributes

Source

LinearSeq.scala

Supertypes

Known subtypes

Base Map type

Base Map type

Attributes

Companion

object

Source

Map.scala

Supertypes

Known subtypes

trait Map[K, V]

trait Map[K, V]

trait Map[K, V]

Show all

This object provides a set of operations to create Iterable values.

This object provides a set of operations to create Iterable values.

Attributes

Companion

trait

Source

Map.scala

Supertypes

Self type

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for maps.

Note that in maps, the CC type of the map is not the same as the CC type for the underlying iterable (which is fixed to Map in MapOps). This trait has therefore two type parameters CC and WithFilterCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.

The default implementations in this trait can be used in the common case when CC[A] is the same as C.

Attributes

Source

Iterable.scala

Supertypes

trait MapOps[K, V, CC, CC[K, V]]

trait K => V

trait IterableOps[(K, V), WithFilterCC, CC[K, V]]

Show all

Known subtypes

trait Map[K, V]

trait Map[K, V]

trait Map[K, V]

trait Map[K, V]

Show all

Base Map implementation type

Base Map implementation type

Type parameters

C

type of the map (e.g. HashMap[Int, String]). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.

CC

type constructor of the map (e.g. HashMap). Operations returning a collection with a different type of entries (L, W) (e.g. map) return a CC[L, W].

K

Type of keys

V

Type of values

Attributes

Companion

object

Source

Map.scala

Supertypes

Known subtypes

trait MapOps[K, V, CC, C]

trait Map[K, V]

trait MapOps[K, V, CC, C]

trait Map[K, V]

trait Map[K, V]

trait Map[K, V]

class Id[K, V]

Show all

Attributes

Companion

object

Source

MapView.scala

Supertypes

trait View[(K, V)]

trait MapOps[K, V, { type l = [X, Y] =>> View[(X, Y)]; }#, View[(K, V)]]

trait K => V

Show all

Known subtypes

Base trait for sequence collections

Base trait for sequence collections

Type parameters

A

the element type of the collection

Attributes

Companion

object

Source

Seq.scala

Supertypes

Known subtypes

This object provides a set of operations to create Iterable values.

This object provides a set of operations to create Iterable values.

Attributes

Companion

trait

Source

Seq.scala

Supertypes

Self type

Type parameters

CC

Collection type constructor (e.g. List)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

A generic trait for ordered maps.

A generic trait for ordered maps. Concrete classes have to provide functionality for the abstract methods in SeqMap.

Note that when checking for equality SeqMap does not take into account ordering.

Type parameters

K

the type of the keys contained in this linked map.

V

the type of the values associated with the keys in this linked map.

Attributes

Companion

object

Source

SeqMap.scala

Supertypes

trait Map[K, V]

trait K => V

Show all

Known subtypes

Base trait for Seq operations

Base trait for Seq operations

Type parameters

A

the element type of the collection

C

type of the collection (e.g. List[Int], String, BitSet). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.

CC

type constructor of the collection (e.g. List, Set). Operations returning a collection with a different type of element B (e.g. map) return a CC[B].

Attributes

Companion

object

Source

Seq.scala

Supertypes

Known subtypes

class ::[A]

class Id[A]

class Map[A, B]

class Id[A]

class Map[A, B]

Show all

Self type

Base trait for set collections.

Base trait for set collections.

Attributes

Companion

object

Source

Set.scala

Supertypes

Known subtypes

This object provides a set of operations to create Iterable values.

This object provides a set of operations to create Iterable values.

Attributes

Companion

trait

Source

Set.scala

Supertypes

Self type

Base trait for set operations

Base trait for set operations

Attributes

Source

Set.scala

Supertypes

Known subtypes

Base trait for companion objects of collections that require an implicit Ordering.

Base trait for companion objects of collections that require an implicit Ordering.

Type parameters

CC

Collection type constructor (e.g. SortedSet)

Attributes

Companion

object

Source

Factory.scala

Supertypes

Known subtypes

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for sorted maps.

Note that in sorted maps, the CC type of the map is not the same as the CC type for the underlying map (which is fixed to Map in SortedMapOps). This trait has therefore three type parameters CC, WithFilterCC and UnsortedCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.

The default implementations in this trait can be used in the common case when CC[A] is the same as C.

Attributes

Source

Iterable.scala

Supertypes

trait MapOps[K, V, UnsortedCC, CC[K, V]]

trait K => V

Show all

Known subtypes

Self type

Base trait for sorted collections

Base trait for sorted collections

Attributes

Source

SortedOps.scala

Supertypes

Known subtypes

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.

This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for sorted sets.

Note that in sorted sets, the CC type of the set is not the same as the CC type for the underlying iterable (which is fixed to Set in SortedSetOps). This trait has therefore two type parameters CC and WithFilterCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.

The default implementations in this trait can be used in the common case when CC[A] is the same as C.

Attributes

Source

Iterable.scala

Supertypes

Known subtypes

Self type

Type parameters

A

Type of elements (e.g. Int, Boolean, etc.)

C

Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)

Attributes

Source

Factory.scala

Supertypes

Known subtypes

Steppers exist to enable creating Java streams over Scala collections, see scala.jdk.StreamConverters. Besides that use case, they allow iterating over collections holding unboxed primitives (e.g., Array[Int]) without boxing the elements.

Steppers have an iterator-like interface with methods hasStep and nextStep(). The difference to iterators - and the reason Stepper is not a subtype of Iterator - is that there are hand-specialized variants of Stepper for Int, Long and Double (IntStepper, etc.). These enable iterating over collections holding unboxed primitives (e.g., Arrays, scala.jdk.Accumulators) without boxing the elements.

The selection of primitive types (Int, Long and Double) matches the hand-specialized variants of Java Streams (java.util.stream.Stream, java.util.stream.IntStream, etc.) and the corresponding Java Spliterators (java.util.Spliterator, java.util.Spliterator.OfInt, etc.).

Steppers can be converted to Scala Iterators, Java Iterators and Java Spliterators. Primitive Steppers are converted to the corresponding primitive Java Iterators and Spliterators.

Type parameters

A

the element type of the Stepper

Attributes

Companion

object

Source

Stepper.scala

Supertypes

Known subtypes

An implicit StepperShape instance is used in the IterableOnce.stepper to return a possibly specialized Stepper S according to the element type T.

Trait that overrides iterable operations to take advantage of strict builders.

Trait that overrides iterable operations to take advantage of strict builders.

Type parameters

A

Elements type

C

Collection type

CC

Collection type constructor

Attributes

Source

StrictOptimizedIterableOps.scala

Supertypes

Known subtypes

Trait that overrides map operations to take advantage of strict builders.

Trait that overrides map operations to take advantage of strict builders.

Type parameters

C

Collection type

CC

Collection type constructor

K

Type of keys

V

Type of values

Attributes

Source

StrictOptimizedMapOps.scala

Supertypes

trait MapOps[K, V, CC, C]

trait K => V

Show all

Known subtypes

Trait that overrides operations on sequences in order to take advantage of strict builders.

Trait that overrides operations on sequences in order to take advantage of strict builders.

Attributes

Source

StrictOptimizedSeqOps.scala

Supertypes

Known subtypes

Trait that overrides set operations to take advantage of strict builders.

Trait that overrides set operations to take advantage of strict builders.

Type parameters

A

Elements type

C

Collection type

CC

Collection type constructor

Attributes

Source

StrictOptimizedSetOps.scala

Supertypes

Known subtypes

Trait that overrides sorted map operations to take advantage of strict builders.

Trait that overrides sorted map operations to take advantage of strict builders.

Type parameters

C

Collection type

CC

Collection type constructor

K

Type of keys

V

Type of values

Attributes

Source

StrictOptimizedSortedMapOps.scala

Supertypes

Known subtypes

Trait that overrides sorted set operations to take advantage of strict builders.

Trait that overrides sorted set operations to take advantage of strict builders.

Type parameters

A

Elements type

C

Collection type

CC

Collection type constructor

Attributes

Source

StrictOptimizedSortedSetOps.scala

Supertypes

Known subtypes

Provides extension methods for strings.

Provides extension methods for strings.

Some of these methods treat strings as a plain collection of Chars without any regard for Unicode handling. Unless the user takes Unicode handling in to account or makes sure the strings don't require such handling, these methods may result in unpaired or invalidly paired surrogate code units.

Attributes

Companion

object

Source

StringOps.scala

Supertypes

Views are collections whose transformation operations are non strict: the resulting elements are evaluated only when the view is effectively traversed (e.g.

Views are collections whose transformation operations are non strict: the resulting elements are evaluated only when the view is effectively traversed (e.g. using foreach or foldLeft), or when the view is converted to a strict collection type (using the to operation).

Attributes

Companion

object

Source

View.scala

Supertypes

Known subtypes

class Id[K, V]

class Id[A]

class Id[A]

class Map[A, B]

class Map[A, B]

class Map[A, B]

class Zip[A, B]

Show all

This object reifies operations on views as case classes

This object reifies operations on views as case classes

Attributes

Companion

trait

Source

View.scala

Supertypes

Self type

A template trait that contains just the map, flatMap, foreach and withFilter methods of trait Iterable.

A template trait that contains just the map, flatMap, foreach and withFilter methods of trait Iterable.

Type parameters

A

Element type (e.g. Int)

CC

Collection type constructor (e.g. List)

Attributes

Source

WithFilter.scala

Supertypes

Known subtypes

A default map which builds a default immutable.Map implementation for all transformations.

A default map which builds a default immutable.Map implementation for all transformations.

Attributes

Deprecated

[Since version 2.13.0] DefaultMap is no longer necessary; extend Map directly

Source

DefaultMap.scala

Supertypes

trait Map[K, V]

trait K => V

Show all

A variety of decorators that enable converting between Scala and Java collections using extension methods, asScala and asJava.

A variety of decorators that enable converting between Scala and Java collections using extension methods, asScala and asJava.

The extension methods return adapters for the corresponding API.

The following conversions are supported via asScala and asJava:

scala.collection.Iterable       <=> java.lang.Iterable
scala.collection.Iterator       <=> java.util.Iterator
scala.collection.mutable.Buffer <=> java.util.List
scala.collection.mutable.Set    <=> java.util.Set
scala.collection.mutable.Map    <=> java.util.Map
scala.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap

The following conversions are supported via asScala and through specially-named extension methods to convert to Java collections, as shown:

scala.collection.Iterable    <=> java.util.Collection   (via asJavaCollection)
scala.collection.Iterator    <=> java.util.Enumeration  (via asJavaEnumeration)
scala.collection.mutable.Map <=> java.util.Dictionary   (via asJavaDictionary)

In addition, the following one-way conversions are provided via asJava:

scala.collection.Seq         => java.util.List
scala.collection.mutable.Seq => java.util.List
scala.collection.Set         => java.util.Set
scala.collection.Map         => java.util.Map

The following one way conversion is provided via asScala:

java.util.Properties => scala.collection.mutable.Map

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

import scala.collection.JavaConverters._

val source = new scala.collection.mutable.ListBuffer[Int]
val target: java.util.List[Int] = source.asJava
val other: scala.collection.mutable.Buffer[Int] = target.asScala
assert(source eq other)

Alternatively, the conversion methods have descriptive names and can be invoked explicitly.

scala> val vs = java.util.Arrays.asList("hi", "bye")
vs: java.util.List[String] = [hi, bye]

scala> val ss = asScalaIterator(vs.iterator)
ss: Iterator[String] = <iterator>

scala> .toList
res0: List[String] = List(hi, bye)

scala> val ss = asScalaBuffer(vs)
ss: scala.collection.mutable.Buffer[String] = Buffer(hi, bye)

Attributes

Deprecated

[Since version 2.13.0] Use `scala.jdk.CollectionConverters` instead

Source

JavaConverters.scala

Supertypes

Self type

Attributes

Deprecated

[Since version 2.13.0] Use SeqOps (for the methods) or IndexedSeqOps (for fast indexed access) instead of ArrayLike

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Use SeqOps instead of SeqLike

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Use Iterable instead of Traversable

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Use IterableOnce instead of TraversableOnce

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Gen* collection types have been removed

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Use Iterable instead of Traversable

Source

package.scala

Attributes

Deprecated

[Since version 2.13.0] Use IterableOnce instead of TraversableOnce

Source

package.scala