scala.collection.mutable

Type members

Classlikes

abstract class AbstractBuffer[A] extends AbstractSeq[A] with Buffer[A]

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

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

Source
Buffer.scala
abstract class AbstractIterable[A] extends AbstractIterable[A] with Iterable[A]

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.

Source
Iterable.scala
abstract class AbstractMap[K, V] extends AbstractMap[K, V] with Map[K, V]

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.

Source
Map.scala
abstract class AbstractSeq[A] extends AbstractSeq[A] with Seq[A]

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.

Source
Seq.scala
abstract class AbstractSet[A] extends AbstractSet[A] with Set[A]

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.

Source
Set.scala
class AnyRefMap[K <: AnyRef, V] extends AbstractMap[K, V] with MapOps[K, V, [K, V] =>> Map[K, V], AnyRefMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], AnyRefMap[K, V]] with Serializable

This class implements mutable maps with AnyRef keys based on a hash table with open addressing.

This class implements mutable maps with AnyRef keys based on a hash table with open addressing.

Basic map operations on single entries, including contains and get, are typically significantly faster with AnyRefMap than HashMap. Note that numbers and characters are not handled specially in AnyRefMap; only plain equals and hashCode are used in comparisons.

Methods that traverse or regenerate the map, including foreach and map, are not in general faster than with HashMap. The methods foreachKey, foreachValue, mapValuesNow, and transformValues are, however, faster than alternative ways to achieve the same functionality.

Maps with open addressing may become less efficient at lookup after repeated addition/removal of elements. Although AnyRefMap makes a decent attempt to remain efficient regardless, calling repack on a map that will no longer have elements removed but will be used heavily may save both time and storage space.

This map is not intended to contain more than 229 entries (approximately 500 million). The maximum capacity is 230, but performance will degrade rapidly as 230 is approached.

Companion
object
Source
AnyRefMap.scala
object AnyRefMap
Companion
class
Source
AnyRefMap.scala

An implementation of the Buffer class using an array to represent the assembled sequence internally.

An implementation of the Buffer class using an array to represent the assembled sequence internally. Append, update and random access take constant time (amortized time). Prepends and removes are linear in the buffer size.

Type Params
A

the type of this arraybuffer's elements.

See also

"Scala's Collection Library overview" section on Array Buffers for more information.

Companion
object
Source
ArrayBuffer.scala

Factory object for the ArrayBuffer class.

Factory object for the ArrayBuffer class.

This object provides a set of operations to create mutable.ArrayBuffer values.

Companion
class
Source
ArrayBuffer.scala
final class ArrayBufferView[A](val array: Array[AnyRef], val length: Int) extends AbstractIndexedSeqView[A]
sealed abstract class ArrayBuilder[T] extends ReusableBuilder[T, Array[T]] with Serializable

A builder class for arrays.

A builder class for arrays.

Type Params
T

the type of the elements for the builder.

Companion
object
Source
ArrayBuilder.scala
object ArrayBuilder

A companion object for array builders.

A companion object for array builders.

Companion
class
Source
ArrayBuilder.scala

An implementation of a double-ended queue that internally uses a resizable circular buffer.

An implementation of a double-ended queue that internally uses a resizable circular buffer.

Append, prepend, removeFirst, removeLast and random-access (indexed-lookup and indexed-replacement) take amortized constant time. In general, removals and insertions at i-th index are O(min(i, n-i)) and thus insertions and removals from end/beginning are fast.

Type Params
A

the type of this ArrayDeque's elements.

Note

Subclasses must override the ofArray protected method to return a more specific type.

Companion
object
Source
ArrayDeque.scala
object ArrayDeque extends StrictOptimizedSeqFactory[[A] =>> ArrayDeque[A]]

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

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

Companion
class
Source
ArrayDeque.scala
trait ArrayDequeOps[A, +CC[_], +C <: AnyRef] extends StrictOptimizedSeqOps[A, CC, C]
sealed abstract class ArraySeq[T] extends AbstractSeq[T] with IndexedSeq[T] with IndexedSeqOps[T, [T] =>> ArraySeq[T], ArraySeq[T]] with StrictOptimizedSeqOps[T, [T] =>> ArraySeq[T], ArraySeq[T]] with Serializable

A collection representing Array[T].

A collection representing Array[T]. Unlike ArrayBuffer it is always backed by the same underlying Array, therefore it is not growable or shrinkable.

Type Params
T

type of the elements in this wrapped array.

Companion
object
Source
ArraySeq.scala

A companion object used to create instances of ArraySeq.

A companion object used to create instances of ArraySeq.

Companion
class
Source
ArraySeq.scala
class BitSet(var elems: Array[Long]) extends AbstractSet[Int] with SortedSet[Int] with SortedSetOps[Int, [A] =>> SortedSet[A], BitSet] with StrictOptimizedIterableOps[Int, [A] =>> Set[A], BitSet] with StrictOptimizedSortedSetOps[Int, [A] =>> SortedSet[A], BitSet] with BitSet with BitSetOps[BitSet] with Serializable

A class for mutable bitsets.

A class for mutable bitsets.

Bitsets are sets of non-negative integers which are represented as variable-size arrays of bits packed into 64-bit words. The lower bound of memory footprint of a bitset is determined by the largest number stored in it.

See also

"Scala's Collection Library overview" section on Mutable Bitsets for more information.

Companion
object
Source
BitSet.scala
trait Buffer[A] extends Seq[A] with SeqOps[A, [A] =>> Buffer[A], Buffer[A]] with Growable[A] with Shrinkable[A] with IterableFactoryDefaults[A, [A] =>> Buffer[A]]

A Buffer is a growable and shrinkable Seq.

A Buffer is a growable and shrinkable Seq.

Companion
object
Source
Buffer.scala
object Buffer extends Delegate[[A] =>> Buffer[A]]
Companion
class
Source
Buffer.scala
trait Builder[-A, +To] extends Growable[A]

Base trait for collection builders.

Base trait for collection builders.

After calling result() the behavior of a Builder (which is not also a scala.collection.mutable.ReusableBuilder) is undefined. No further methods should be called. It is common for mutable collections to be their own non-reusable Builder, in which case result() simply returns this.

See also

scala.collection.mutable.ReusableBuilder for Builders which can be reused after calling result()

Source
Builder.scala
trait Clearable

This trait forms part of collections that can be cleared with a clear() call.

This trait forms part of collections that can be cleared with a clear() call.

Source
Growable.scala
trait Cloneable[+C <: AnyRef] extends Cloneable

A trait for cloneable collections.

A trait for cloneable collections.

Type Params
C

Type of the collection, covariant and with reference types as upperbound.

Source
Cloneable.scala
final class CollisionProofHashMap[K, V](initialCapacity: Int, loadFactor: Double)(implicit ordering: Ordering[K]) extends AbstractMap[K, V] with MapOps[K, V, [K, V] =>> Map[K, V], CollisionProofHashMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], CollisionProofHashMap[K, V]] with StrictOptimizedMapOps[K, V, [K, V] =>> Map[K, V], CollisionProofHashMap[K, V]]

This class implements mutable maps using a hashtable with red-black trees in the buckets for good worst-case performance on hash collisions.

This class implements mutable maps using a hashtable with red-black trees in the buckets for good worst-case performance on hash collisions. An Ordering is required for the element type. Equality as determined by the Ordering has to be consistent with equals and hashCode. Universal equality of numeric types is not supported (similar to AnyRefMap).

See also

"Scala's Collection Library overview" section on Hash Tables for more information.

Companion
object
Source
CollisionProofHashMap.scala

This object provides a set of operations to create mutable.CollisionProofHashMap values.

This object provides a set of operations to create mutable.CollisionProofHashMap values.

Companion
class
Source
CollisionProofHashMap.scala
trait Growable[-A] extends Clearable

This trait forms part of collections that can be augmented using a += operator and that can be cleared of all elements using a clear method.

This trait forms part of collections that can be augmented using a += operator and that can be cleared of all elements using a clear method.

Companion
object
Source
Growable.scala
object Growable
Companion
class
Source
Growable.scala
class GrowableBuilder[Elem, To <: Growable[Elem]](val elems: To) extends Builder[Elem, To]

The canonical builder for collections that are growable, i.e.

The canonical builder for collections that are growable, i.e. that support an efficient += method which adds an element to the collection.

GrowableBuilders can produce only a single instance of the collection they are growing.

Source
GrowableBuilder.scala
@deprecatedInheritance("HashMap will be made final; use .withDefault for the common use case of computing a default value", "2.13.0")
class HashMap[K, V](initialCapacity: Int, loadFactor: Double) extends AbstractMap[K, V] with MapOps[K, V, [K, V] =>> HashMap[K, V], HashMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], HashMap[K, V]] with StrictOptimizedMapOps[K, V, [K, V] =>> HashMap[K, V], HashMap[K, V]] with MapFactoryDefaults[K, V, [K, V] =>> HashMap[K, V], [A] =>> Iterable[A]] with Serializable

This class implements mutable maps using a hashtable.

This class implements mutable maps using a hashtable.

Type Params
K

the type of the keys contained in this hash map.

V

the type of the values assigned to keys in this hash map.

See also

"Scala's Collection Library overview" section on Hash Tables for more information.

Companion
object
Source
HashMap.scala
object HashMap extends MapFactory[[K, V] =>> HashMap[K, V]]

This object provides a set of operations to create mutable.HashMap values.

This object provides a set of operations to create mutable.HashMap values.

Companion
class
Source
HashMap.scala
final class HashSet[A](initialCapacity: Int, loadFactor: Double) extends AbstractSet[A] with SetOps[A, [A] =>> HashSet[A], HashSet[A]] with StrictOptimizedIterableOps[A, [A] =>> HashSet[A], HashSet[A]] with IterableFactoryDefaults[A, [A] =>> HashSet[A]] with Serializable

This class implements mutable sets using a hashtable.

This class implements mutable sets using a hashtable.

See also

"Scala's Collection Library overview" section on Hash Tables for more information.

Companion
object
Source
HashSet.scala
object HashSet extends IterableFactory[[A] =>> HashSet[A]]

This object provides a set of operations to create mutable.HashSet values.

This object provides a set of operations to create mutable.HashSet values.

Companion
class
Source
HashSet.scala
abstract class ImmutableBuilder[-A, C <: IterableOnce[_]](empty: C) extends ReusableBuilder[A, C]

Reusable builder for immutable collections

Reusable builder for immutable collections

Source
ImmutableBuilder.scala
trait IndexedBuffer[A] extends IndexedSeq[A] with IndexedSeqOps[A, [A] =>> IndexedBuffer[A], IndexedBuffer[A]] with Buffer[A] with IterableFactoryDefaults[A, [A] =>> IndexedBuffer[A]]
Companion
object
Source
Buffer.scala
object IndexedBuffer extends Delegate[[A] =>> IndexedBuffer[A]]
Companion
class
Source
Buffer.scala
trait IndexedSeq[T] extends Seq[T] with IndexedSeq[T] with IndexedSeqOps[T, [T] =>> IndexedSeq[T], IndexedSeq[T]] with IterableFactoryDefaults[T, [T] =>> IndexedSeq[T]]
Companion
object
Source
IndexedSeq.scala
object IndexedSeq extends Delegate[[T] =>> IndexedSeq[T]]
Companion
class
Source
IndexedSeq.scala
trait IndexedSeqOps[A, +CC[_], +C <: AnyRef] extends IndexedSeqOps[A, CC, C] with SeqOps[A, CC, C]
trait Iterable[A] extends Iterable[A] with IterableOps[A, [A] =>> Iterable[A], Iterable[A]] with IterableFactoryDefaults[A, [A] =>> Iterable[A]]
Companion
object
Source
Iterable.scala
object Iterable extends Delegate[[A] =>> Iterable[A]]

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

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

Companion
class
Source
Iterable.scala
object LinkedHashMap extends MapFactory[[K, V] =>> LinkedHashMap[K, V]]

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

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

Companion
class
Source
LinkedHashMap.scala
class LinkedHashMap[K, V] extends AbstractMap[K, V] with SeqMap[K, V] with MapOps[K, V, [K, V] =>> LinkedHashMap[K, V], LinkedHashMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], LinkedHashMap[K, V]] with StrictOptimizedMapOps[K, V, [K, V] =>> LinkedHashMap[K, V], LinkedHashMap[K, V]] with MapFactoryDefaults[K, V, [K, V] =>> LinkedHashMap[K, V], [A] =>> Iterable[A]] with DefaultSerializable

This class implements mutable maps using a hashtable.

This class implements mutable maps using a hashtable. The iterator and all traversal methods of this class visit elements in the order they were inserted.

Type Params
K

the type of the keys contained in this hash map.

V

the type of the values assigned to keys in this hash map.

Companion
object
Source
LinkedHashMap.scala

This class implements mutable sets using a hashtable.

This class implements mutable sets using a hashtable. The iterator and all traversal methods of this class visit elements in the order they were inserted.

Type Params
A

the type of the elements contained in this set.

Companion
object
Source
LinkedHashSet.scala
object LinkedHashSet extends IterableFactory[[A] =>> LinkedHashSet[A]]

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

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

Companion
class
Source
LinkedHashSet.scala
@SerialVersionUID(-8428291952499836345L)

A Buffer implementation backed by a list.

A Buffer implementation backed by a list. It provides constant time prepend and append. Most other operations are linear.

Type Params
A

the type of this list buffer's elements.

See also

"Scala's Collection Library overview" section on List Buffers for more information.

Companion
object
Source
ListBuffer.scala
final class LongMap[V] extends AbstractMap[Long, V] with MapOps[Long, V, [K, V] =>> Map[K, V], LongMap[V]] with StrictOptimizedIterableOps[(Long, V), [A] =>> Iterable[A], LongMap[V]] with Serializable

This class implements mutable maps with Long keys based on a hash table with open addressing.

This class implements mutable maps with Long keys based on a hash table with open addressing.

Basic map operations on single entries, including contains and get, are typically substantially faster with LongMap than HashMap. Methods that act on the whole map, including foreach and map are not in general expected to be faster than with a generic map, save for those that take particular advantage of the internal structure of the map: foreachKey, foreachValue, mapValuesNow, and transformValues.

Maps with open addressing may become less efficient at lookup after repeated addition/removal of elements. Although LongMap makes a decent attempt to remain efficient regardless, calling repack on a map that will no longer have elements removed but will be used heavily may save both time and storage space.

This map is not intended to contain more than 229 entries (approximately 500 million). The maximum capacity is 230, but performance will degrade rapidly as 2^30 is approached.

Companion
object
Source
LongMap.scala
object LongMap
Companion
class
Source
LongMap.scala
trait Map[K, V] extends Iterable[(K, V)] with Map[K, V] with MapOps[K, V, [K, V] =>> Map[K, V], Map[K, V]] with Growable[(K, V)] with Shrinkable[K] with MapFactoryDefaults[K, V, [K, V] =>> Map[K, V], [A] =>> Iterable[A]]

Base type of mutable Maps

Base type of mutable Maps

Companion
object
Source
Map.scala
object Map extends Delegate[[K, V] =>> Map[K, V]]

This object provides a set of operations to create mutable.Map values.

This object provides a set of operations to create mutable.Map values.

Companion
class
Source
Map.scala
trait MapOps[K, V, +CC <: ([X, Y] =>> MapOps[X, Y, CC, _]), +C <: MapOps[K, V, CC, C]] extends IterableOps[(K, V), [A] =>> Iterable[A], C] with MapOps[K, V, CC, C] with Cloneable[C] with Builder[(K, V), C] with Growable[(K, V)] with Shrinkable[K]
Source
Map.scala
sealed class PriorityQueue[A](implicit val ord: Ordering[A]) extends AbstractIterable[A] with Iterable[A] with IterableOps[A, [A] =>> Iterable[A], PriorityQueue[A]] with StrictOptimizedIterableOps[A, [A] =>> Iterable[A], PriorityQueue[A]] with Builder[A, PriorityQueue[A]] with Cloneable[PriorityQueue[A]] with Growable[A] with Serializable

This class implements priority queues using a heap.

This class implements priority queues using a heap. To prioritize elements of type A there must be an implicit Ordering[A] available at creation.

If multiple elements have the same priority in the ordering of this PriorityQueue, no guarantees are made regarding the order in which elements are returned by dequeue or dequeueAll. In particular, that means this class does not guarantee first in first out behaviour that may be incorrectly inferred from the Queue part of the name of this class.

Only the dequeue and dequeueAll methods will return elements in priority order (while removing elements from the heap). Standard collection methods including drop, iterator, and toString will remove or traverse the heap in whichever order seems most convenient.

Therefore, printing a PriorityQueue will not reveal the priority order of the elements, though the highest-priority element will be printed first. To print the elements in order, one must duplicate the PriorityQueue (by using clone, for instance) and then dequeue them:

Type Params
A

type of the elements in this priority queue.

Value Params
ord

implicit ordering used to compare the elements of type A.

Example

val pq = collection.mutable.PriorityQueue(1, 2, 5, 3, 7)
println(pq)                  // elements probably not in order
println(pq.clone.dequeueAll) // prints ArraySeq(7, 5, 3, 2, 1)
Companion
object
Source
PriorityQueue.scala
class Queue[A] extends ArrayDeque[A] with IndexedSeqOps[A, [A] =>> Queue[A], Queue[A]] with StrictOptimizedSeqOps[A, [A] =>> Queue[A], Queue[A]] with IterableFactoryDefaults[A, [A] =>> Queue[A]] with ArrayDequeOps[A, [A] =>> Queue[A], Queue[A]] with Cloneable[Queue[A]] with DefaultSerializable

Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.

Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.

Companion
object
Source
Queue.scala
object Queue extends StrictOptimizedSeqFactory[[A] =>> Queue[A]]

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

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

Companion
class
Source
Queue.scala
trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To]

ReusableBuilder is a marker trait that indicates that a Builder can be reused to build more than one instance of a collection.

ReusableBuilder is a marker trait that indicates that a Builder can be reused to build more than one instance of a collection. In particular, calling result() followed by clear() will produce a collection and reset the builder to begin building a new collection of the same type.

In general no method other than clear() may be called after result(). It is up to subclasses to implement and to document other allowed sequences of operations (e.g. calling other methods after result() in order to obtain different snapshots of a collection under construction).

Type Params
Elem

the type of elements that get added to the builder.

To

the type of collection that it produced.

Source
ReusableBuilder.scala
trait Seq[A] extends Iterable[A] with Seq[A] with SeqOps[A, [A] =>> Seq[A], Seq[A]] with IterableFactoryDefaults[A, [A] =>> Seq[A]]
Companion
object
Source
Seq.scala
object Seq extends Delegate[[A] =>> Seq[A]]

This object provides a set of operations to create mutable.Seq values.

This object provides a set of operations to create mutable.Seq values.

Companion
class
Source
Seq.scala
trait SeqMap[K, V] extends Map[K, V] with SeqMap[K, V] with MapOps[K, V, [K, V] =>> SeqMap[K, V], SeqMap[K, V]] with MapFactoryDefaults[K, V, [K, V] =>> SeqMap[K, V], [A] =>> Iterable[A]]

A generic trait for ordered mutable maps.

A generic trait for ordered mutable 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 Params
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.

Companion
object
Source
SeqMap.scala
object SeqMap extends Delegate[[K, V] =>> SeqMap[K, V]]
Companion
class
Source
SeqMap.scala
trait SeqOps[A, +CC[_], +C <: AnyRef] extends SeqOps[A, CC, C] with Cloneable[C]
Source
Seq.scala
trait Set[A] extends Iterable[A] with Set[A] with SetOps[A, [A] =>> Set[A], Set[A]] with IterableFactoryDefaults[A, [A] =>> Set[A]]

Base trait for mutable sets

Base trait for mutable sets

Companion
object
Source
Set.scala
object Set extends Delegate[[A] =>> Set[A]]

This object provides a set of operations to create mutable.Set values.

This object provides a set of operations to create mutable.Set values.

Companion
class
Source
Set.scala
trait SetOps[A, +CC[X], +C <: SetOps[A, CC, C]] extends SetOps[A, CC, C] with IterableOps[A, CC, C] with Cloneable[C] with Builder[A, C] with Growable[A] with Shrinkable[A]
Source
Set.scala
trait Shrinkable[-A]

This trait forms part of collections that can be reduced using a -= operator.

This trait forms part of collections that can be reduced using a -= operator.

Source
Shrinkable.scala
trait SortedMap[K, V] extends SortedMap[K, V] with Map[K, V] with SortedMapOps[K, V, [K, V] =>> SortedMap[K, V], SortedMap[K, V]] with SortedMapFactoryDefaults[K, V, [K, V] =>> SortedMap[K, V], [A] =>> Iterable[A], [K, V] =>> Map[K, V]]

Base type for mutable sorted map collections

Base type for mutable sorted map collections

Companion
object
Source
SortedMap.scala
object SortedMap extends Delegate[[K, V] =>> SortedMap[K, V]]
Companion
class
Source
SortedMap.scala
trait SortedMapOps[K, V, +CC <: ([X, Y] =>> Map[X, Y] & SortedMapOps[X, Y, CC, _]), +C <: SortedMapOps[K, V, CC, C]] extends SortedMapOps[K, V, CC, C] with MapOps[K, V, [K, V] =>> Map[K, V], C]
trait SortedSet[A] extends Set[A] with SortedSet[A] with SortedSetOps[A, [A] =>> SortedSet[A], SortedSet[A]] with SortedSetFactoryDefaults[A, [A] =>> SortedSet[A], [A] =>> Set[A]]

Base type for mutable sorted set collections

Base type for mutable sorted set collections

Companion
object
Source
SortedSet.scala
object SortedSet extends Delegate[[A] =>> SortedSet[A]]

This object provides a set of operations to create mutable.Sortedset values.

This object provides a set of operations to create mutable.Sortedset values.

Companion
class
Source
SortedSet.scala
trait SortedSetOps[A, +CC <: ([X] =>> SortedSet[X]), +C <: SortedSetOps[A, CC, C]] extends SetOps[A, [A] =>> Set[A], C] with SortedSetOps[A, CC, C]
@migration("Stack is now based on an ArrayDeque instead of a linked list", "2.13.0")
class Stack[A] extends ArrayDeque[A] with IndexedSeqOps[A, [A] =>> Stack[A], Stack[A]] with StrictOptimizedSeqOps[A, [A] =>> Stack[A], Stack[A]] with IterableFactoryDefaults[A, [A] =>> Stack[A]] with ArrayDequeOps[A, [A] =>> Stack[A], Stack[A]] with Cloneable[Stack[A]] with DefaultSerializable

A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.

A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.

Type Params
A

type of the elements contained in this stack.

Companion
object
Source
Stack.scala
object Stack extends StrictOptimizedSeqFactory[[A] =>> Stack[A]]

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

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

Companion
class
Source
Stack.scala

A builder for mutable sequence of characters.

A builder for mutable sequence of characters. This class provides an API mostly compatible with java.lang.StringBuilder, except where there are conflicts with the Scala collections API (such as the reverse method.)

This Builder can be reused after calling result() without an intermediate call to clear() in order to build multiple related results.

Companion
object
Source
StringBuilder.scala
sealed class TreeMap[K, V] extends AbstractMap[K, V] with SortedMap[K, V] with SortedMapOps[K, V, [K, V] =>> TreeMap[K, V], TreeMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], TreeMap[K, V]] with StrictOptimizedMapOps[K, V, [K, V] =>> Map[K, V], TreeMap[K, V]] with StrictOptimizedSortedMapOps[K, V, [K, V] =>> TreeMap[K, V], TreeMap[K, V]] with SortedMapFactoryDefaults[K, V, [K, V] =>> TreeMap[K, V], [A] =>> Iterable[A], [K, V] =>> Map[K, V]] with DefaultSerializable

A mutable sorted map implemented using a mutable red-black tree as underlying data structure.

A mutable sorted map implemented using a mutable red-black tree as underlying data structure.

Type Params
K

the type of the keys contained in this tree map.

V

the type of the values associated with the keys.

Value Params
ordering

the implicit ordering used to compare objects of type A.

Companion
object
Source
TreeMap.scala
object TreeMap extends SortedMapFactory[[K, V] =>> TreeMap[K, V]]

This object provides a set of operations to create mutable.TreeMap values.

This object provides a set of operations to create mutable.TreeMap values.

Companion
class
Source
TreeMap.scala
sealed class TreeSet[A] extends AbstractSet[A] with SortedSet[A] with SortedSetOps[A, [A] =>> TreeSet[A], TreeSet[A]] with StrictOptimizedIterableOps[A, [A] =>> Set[A], TreeSet[A]] with StrictOptimizedSortedSetOps[A, [A] =>> TreeSet[A], TreeSet[A]] with SortedSetFactoryDefaults[A, [A] =>> TreeSet[A], [A] =>> Set[A]] with DefaultSerializable

A mutable sorted set implemented using a mutable red-black tree as underlying data structure.

A mutable sorted set implemented using a mutable red-black tree as underlying data structure.

Type Params
A

the type of the keys contained in this tree set.

Value Params
ordering

the implicit ordering used to compare objects of type A.

Companion
object
Source
TreeSet.scala
object TreeSet extends SortedIterableFactory[[A] =>> TreeSet[A]]

This object provides a set of operations to create mutable.TreeSet values.

This object provides a set of operations to create mutable.TreeSet values.

Companion
class
Source
TreeSet.scala
sealed class UnrolledBuffer[T](implicit val tag: ClassTag[T]) extends AbstractBuffer[T] with Buffer[T] with Seq[T] with SeqOps[T, [T] =>> UnrolledBuffer[T], UnrolledBuffer[T]] with StrictOptimizedSeqOps[T, [T] =>> UnrolledBuffer[T], UnrolledBuffer[T]] with EvidenceIterableFactoryDefaults[T, [T] =>> UnrolledBuffer[T], [T] =>> ClassTag[T]] with Builder[T, UnrolledBuffer[T]] with DefaultSerializable

A buffer that stores elements in an unrolled linked list.

A buffer that stores elements in an unrolled linked list.

Unrolled linked lists store elements in linked fixed size arrays.

Unrolled buffers retain locality and low memory overhead properties of array buffers, but offer much more efficient element addition, since they never reallocate and copy the internal array.

However, they provide O(n/m) complexity random access, where n is the number of elements, and m the size of internal array chunks.

Ideal to use when: - elements are added to the buffer and then all of the elements are traversed sequentially - two unrolled buffers need to be concatenated (see concat)

Better than singly linked lists for random access, but should still be avoided for such a purpose.

Companion
object
Source
UnrolledBuffer.scala
class WeakHashMap[K, V] extends JMapWrapper[K, V] with JMapWrapperLike[K, V, [K, V] =>> WeakHashMap[K, V], WeakHashMap[K, V]] with MapFactoryDefaults[K, V, [K, V] =>> WeakHashMap[K, V], [A] =>> Iterable[A]]

A hash map with references to entries which are weakly reachable.

A hash map with references to entries which are weakly reachable. Entries are removed from this map when the key is no longer (strongly) referenced. This class wraps java.util.WeakHashMap.

Type Params
K

type of keys contained in this map

V

type of values associated with the keys

See also

"Scala's Collection Library overview" section on Weak Hash Maps for more information.

Companion
object
Source
WeakHashMap.scala
object WeakHashMap extends MapFactory[[K, V] =>> WeakHashMap[K, V]]

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

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

Companion
class
Source
WeakHashMap.scala

Deprecated classlikes

@deprecated("Use an immutable.ListMap assigned to a var instead of mutable.ListMap", "2.13.0")
class ListMap[K, V] extends AbstractMap[K, V] with MapOps[K, V, [K, V] =>> ListMap[K, V], ListMap[K, V]] with StrictOptimizedIterableOps[(K, V), [A] =>> Iterable[A], ListMap[K, V]] with StrictOptimizedMapOps[K, V, [K, V] =>> ListMap[K, V], ListMap[K, V]] with MapFactoryDefaults[K, V, [K, V] =>> ListMap[K, V], [A] =>> Iterable[A]] with DefaultSerializable

A simple mutable map backed by a list, so it preserves insertion order.

A simple mutable map backed by a list, so it preserves insertion order.

Type Params
K

the type of the keys contained in this list map.

V

the type of the values assigned to keys in this list map.

Companion
object
Deprecated
Source
ListMap.scala
@SerialVersionUID(3L) @deprecated("Use an immutable.ListMap assigned to a var instead of mutable.ListMap", "2.13.0")
object ListMap extends MapFactory[[K, V] =>> ListMap[K, V]]

This object provides a set of operations to create mutable.ListMap values.

This object provides a set of operations to create mutable.ListMap values.

Companion
class
Deprecated
Source
ListMap.scala
@deprecated("Use a scala.collection.mutable.MultiDict in the scala-collection-contrib module", "2.13.0")
trait MultiMap[K, V] extends Map[K, Set[V]]

A trait for mutable maps with multiple values assigned to a key.

A trait for mutable maps with multiple values assigned to a key.

This class is typically used as a mixin. It turns maps which map K to Set[V] objects into multimaps that map K to V objects.

Example

// first import all necessary types from package `collection.mutable`
import collection.mutable.{ HashMap, MultiMap, Set }
// to create a `MultiMap` the easiest way is to mixin it into a normal
// `Map` instance
val mm = new HashMap[Int, Set[String]] with MultiMap[Int, String]
// to add key-value pairs to a multimap it is important to use
// the method `addBinding` because standard methods like `+` will
// overwrite the complete key-value pair instead of adding the
// value to the existing key
mm.addBinding(1, "a")
mm.addBinding(2, "b")
mm.addBinding(1, "c")
// mm now contains `Map(2 -> Set(b), 1 -> Set(c, a))`
// to check if the multimap contains a value there is method
// `entryExists`, which allows to traverse the including set
mm.entryExists(1, _ == "a") == true
mm.entryExists(1, _ == "b") == false
mm.entryExists(2, _ == "b") == true
// to remove a previous added value there is the method `removeBinding`
mm.removeBinding(1, "a")
mm.entryExists(1, _ == "a") == false
Deprecated
Source
MultiMap.scala
@deprecated("Use HashMap or one of the specialized versions (LongMap, AnyRefMap) instead of OpenHashMap", "2.13.0") @SerialVersionUID(3L)
object OpenHashMap extends MapFactory[[Key, Value] =>> OpenHashMap[Key, Value]]
Companion
class
Deprecated
Source
OpenHashMap.scala
@deprecated("Use HashMap or one of the specialized versions (LongMap, AnyRefMap) instead of OpenHashMap", "2.13.0")
class OpenHashMap[Key, Value](initialSize: Int) extends AbstractMap[Key, Value] with MapOps[Key, Value, [Key, Value] =>> OpenHashMap[Key, Value], OpenHashMap[Key, Value]] with StrictOptimizedIterableOps[(Key, Value), [A] =>> Iterable[A], OpenHashMap[Key, Value]] with MapFactoryDefaults[Key, Value, [Key, Value] =>> OpenHashMap[Key, Value], [A] =>> Iterable[A]] with DefaultSerializable

A mutable hash map based on an open addressing method.

A mutable hash map based on an open addressing method. The precise scheme is undefined, but it should make a reasonable effort to ensure that an insert with consecutive hash codes is not unnecessarily penalised. In particular, mappings of consecutive integer keys should work without significant performance loss.

Type Params
Key

type of the keys in this map.

Value

type of the values in this map.

Value Params
initialSize

the initial size of the internal hash table.

Companion
object
Deprecated
Source
OpenHashMap.scala

Deprecated types

@deprecated("Use Stack instead of ArrayStack; it now uses an array-based implementation", "2.13.0")
type ArrayStack[X] = Stack[X]
Deprecated
Source
package.scala
@deprecated("GrowingBuilder has been renamed to GrowableBuilder", "2.13.0")
Deprecated
Source
package.scala
@deprecated("IndexedOptimizedBuffer has been renamed to IndexedBuffer", "2.13.0")
Deprecated
Source
package.scala
@deprecated("IndexedOptimizedSeq has been renamed to IndexedSeq", "2.13.0")
Deprecated
Source
package.scala
@deprecated("mutable.LinearSeq has been removed; use LinearSeq with mutable.Seq instead", "2.13.0")
type LinearSeq[X] = Seq[X] & LinearSeq[X]
Deprecated
Source
package.scala
@deprecated("Use Iterable instead of Traversable", "2.13.0")
type Traversable[X] = Iterable[X]
Deprecated
Source
package.scala
@deprecated("Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays", "2.13.0")
type WrappedArray[X] = ArraySeq[X]
Deprecated
Source
package.scala

Value members

Deprecated fields

@deprecated("Use Stack instead of ArrayStack; it now uses an array-based implementation", "2.13.0")
Deprecated
Source
package.scala
@deprecated("Use Iterable instead of Traversable", "2.13.0")
Deprecated
Source
package.scala
@deprecated("Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays", "2.13.0")
Deprecated
Source
package.scala