Explicit instantiation of theBuffer trait to reduce class file size in subclasses.
Explicit instantiation of theBuffer trait to reduce class file size in subclasses.
Explicit instantiation of theIterable trait to reduce class file size in subclasses.
Explicit instantiation of theIterable trait to reduce class file size in subclasses.
Explicit instantiation of theMap trait to reduce class file size in subclasses.
Explicit instantiation of theMap trait to reduce class file size in subclasses.
Explicit instantiation of theSeq trait to reduce class file size in subclasses.
Explicit instantiation of theSeq trait to reduce class file size in subclasses.
Explicit instantiation of theSet trait to reduce class file size in subclasses.
Explicit instantiation of theSet trait to reduce class file size in subclasses.
An implementation of theBuffer class using an array to represent the assembled sequence internally.
An implementation of theBuffer 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.
the type of this arraybuffer's elements.
"Scala's Collection Library overview" section onArray Buffers for more information.
Factory object for theArrayBuffer class.
Factory object for theArrayBuffer class.
This object provides a set of operations to createIterable values.
A builder class for arrays.
A builder class for arrays.
the type of the elements for the builder.
A companion object for array builders.
A companion object for array builders.
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, removeHead, 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.
the type of this ArrayDeque's elements.
Subclassesmust override theofArray protected method to return a more specific type.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
A collection representingArray[T].
A collection representingArray[T]. UnlikeArrayBuffer it is always backed by the same underlyingArray, therefore it is not growable or shrinkable.
type of the elements in this wrapped array.
A companion object used to create instances ofArraySeq.
A companion object used to create instances ofArraySeq.
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.
"Scala's Collection Library overview" section onMutable Bitsets for more information.
ABuffer is a growable and shrinkableSeq.
ABuffer is a growable and shrinkableSeq.
Base trait for collection builders.
Base trait for collection builders.
After callingresult() the behavior of a Builder (which is not also ascala.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 caseresult() simply returnsthis.
scala.collection.mutable.ReusableBuilder for Builders which can be reused after callingresult()
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.
A trait for cloneable collections.
A trait for cloneable collections.
Type of the collection, covariant and with reference types as upperbound.
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. AnOrdering is required for the element type. Equality as determined by theOrdering has to be consistent withequals andhashCode. Universal equality of numeric types is not supported (similar toAnyRefMap).
"Scala's Collection Library overview" section onHash Tables for more information.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
This trait forms part of collections that can be augmented using a+= operator and that can be cleared of all elements using aclear method.
This trait forms part of collections that can be augmented using a+= operator and that can be cleared of all elements using aclear method.
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.
This class implements mutable maps using a hashtable.
This class implements mutable maps using a hashtable.
the type of the keys contained in this hash map.
the type of the values assigned to keys in this hash map.
"Scala's Collection Library overview" section onHash Tables for more information.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
This class implements mutable sets using a hashtable.
This class implements mutable sets using a hashtable.
"Scala's Collection Library overview" section onHash Tables for more information.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
Reusable builder for immutable collections
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
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.
the type of the keys contained in this hash map.
the type of the values assigned to keys in this hash map.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
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.
the type of the elements contained in this set.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
ABuffer implementation backed by a list.
ABuffer implementation backed by a list. It provides constant time prepend and append. Most other operations are linear.
the type of this list buffer's elements.
"Scala's Collection Library overview" section onList Buffers for more information.
This class implements mutable maps withLong keys based on a hash table with open addressing.
This class implements mutable maps withLong keys based on a hash table with open addressing.
Basic map operations on single entries, includingcontains andget, are typically substantially faster withLongMap thanHashMap. Methods that act on the whole map, includingforeach andmap 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, andtransformValues.
Maps with open addressing may become less efficient at lookup after repeated addition/removal of elements. AlthoughLongMap makes a decent attempt to remain efficient regardless, callingrepack 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.
Base type of mutable Maps
Base type of mutable Maps
This object provides a set of operations to createIterable values.
A heap-based priority queue.
A heap-based priority queue.
To prioritize elements of typeA there must be an implicitOrdering[A] available at creation. Elements are retrieved in priority order by usingdequeue ordequeueAll.
If multiple elements have the same priority as determined by the ordering for thisPriorityQueue, no guarantees are made regarding the order in which those elements are returned bydequeue ordequeueAll. In particular, that means this class does not guarantee first-in-first-out behavior, as may be incorrectly inferred from the fact that this data structure is called a "queue".
Only thedequeue anddequeueAll methods will return elements in priority order (while removing elements from the heap). Standard collection methods such asdrop,iterator,toList andtoString use an arbitrary iteration order: they will traverse the heap or remove elements in whichever order seems most convenient.
Therefore, printing aPriorityQueue will not show elements in priority order, though the highest-priority element will be printed first. To print the elements in order, it's necessary todequeue them. To do this non-destructively, duplicate thePriorityQueue first; theclone method is a suitable way to obtain a disposable copy.
Client keys are assumed to be immutable. Mutating keys may violate the invariant of the underlying heap-ordered tree. Note thatclone does not rebuild the underlying tree.
scala> val pq = collection.mutable.PriorityQueue(1, 2, 5, 3, 7)val pq: scala.collection.mutable.PriorityQueue[Int] = PriorityQueue(7, 3, 5, 1, 2)scala> pq.toList // also not in orderval res0: List[Int] = List(7, 3, 5, 1, 2)scala> pq.clone.dequeueAllval res1: Seq[Int] = ArraySeq(7, 5, 3, 2, 1)type of the elements in this priority queue.
implicit ordering used to compare the elements of typeA.
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.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
ReusableBuilder is a marker trait that indicates that aBuilder can be reused to build more than one instance of a collection.
ReusableBuilder is a marker trait that indicates that aBuilder can be reused to build more than one instance of a collection. In particular, callingresult() followed byclear() will produce a collection and reset the builder to begin building a new collection of the same type.
In general no method other thanclear() may be called afterresult(). It is up to subclasses to implement and to document other allowed sequences of operations (e.g. calling other methods afterresult() in order to obtain different snapshots of a collection under construction).
the type of elements that get added to the builder.
the type of collection that it produced.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
A generic trait for ordered mutable maps.
A generic trait for ordered mutable maps. Concrete classes have to provide functionality for the abstract methods inSeqMap.
Note that when checking for equalitySeqMap does not take into account ordering.
the type of the keys contained in this linked map.
the type of the values associated with the keys in this linked map.
Base trait for mutable sets
Base trait for mutable sets
This object provides a set of operations to createIterable values.
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.
Base type for mutable sorted map collections
Base type for mutable sorted map collections
Base type for mutable sorted set collections
Base type for mutable sorted set collections
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
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.
Note that operations which consume and produce iterables preserve order, rather than reversing it (as would be expected from building a new stack by pushing an element at a time).
type of the elements contained in this stack.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
A builder ofString which is also a mutable sequence of characters.
A builder ofString which is also a mutable sequence of characters.
This class provides an API mostly compatible withjava.lang.StringBuilder, except where there are conflicts with the Scala collections API, such as thereverse method:reverse produces a newStringBuilder, andreverseInPlace mutates this builder.
Mutating operations return eitherthis.type, i.e., the current builder, orUnit.
Other methods extract data or information from the builder without mutating it.
The distinction is also reflected in naming conventions used by collections, such asappend, which mutates, andappended, which does not, orreverse, which does not mutate, andreverseInPlace, which does.
TheString result may be obtained using eitherresult() ortoString.
This Builder can be reused after callingresult() without an intermediate call toclear() in order to build multiple related results.
"Scala's Collection Library overview" section onStringBuilders for more information.
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.
the type of the keys contained in this tree map.
the type of the values associated with the keys.
the implicit ordering used to compare objects of typeA.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
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.
the type of the keys contained in this tree set.
the implicit ordering used to compare objects of typeA.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
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 provideO(n/m) complexity random access, wheren is the number of elements, andm 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 (seeconcat)
Better than singly linked lists for random access, but should still be avoided for such a purpose.
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 wrapsjava.util.WeakHashMap.
type of keys contained in this map
type of values associated with the keys
"Scala's Collection Library overview" section onWeak Hash Maps for more information.
This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
This class implements mutable maps withAnyRef keys based on a hash table with open addressing.
This class implements mutable maps withAnyRef keys based on a hash table with open addressing.
Basic map operations on single entries, includingcontains andget, are typically significantly faster withAnyRefMap thanHashMap. Note that numbers and characters are not handled specially in AnyRefMap; only plainequals andhashCode are used in comparisons.
Methods that traverse or regenerate the map, includingforeach andmap, are not in general faster than withHashMap. The methodsforeachKey,foreachValue,mapValuesNow, andtransformValues 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. AlthoughAnyRefMap makes a decent attempt to remain efficient regardless, callingrepack 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.
[Since version 2.13.16]Use `scala.collection.mutable.HashMap` instead for better performance.[Since version 2.13.16]Use `scala.collection.mutable.HashMap` instead for better performance.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.
the type of the keys contained in this list map.
the type of the values assigned to keys in this list map.
[Since version 2.13.0]Use an immutable.ListMap assigned to a var instead of mutable.ListMap This object provides a set of operations to createIterable values.
This object provides a set of operations to createIterable values.
[Since version 2.13.0]Use an immutable.ListMap assigned to a var instead of mutable.ListMapA 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 mapK toSet[V] objects into multimaps that mapK toV objects.
// 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` instanceval 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 keymm.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 setmm.entryExists(1, _ == "a") == truemm.entryExists(1, _ == "b") == falsemm.entryExists(2, _ == "b") == true// to remove a previous added value there is the method `removeBinding`mm.removeBinding(1, "a")mm.entryExists(1, _ == "a") == false[Since version 2.13.0]Use a scala.collection.mutable.MultiDict in the scala-collection-contrib module[Since version 2.13.0]Use HashMap or one of the specialized versions (LongMap, AnyRefMap) instead of OpenHashMapA 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 of the keys in this map.
type of the values in this map.
the initial size of the internal hash table.
[Since version 2.13.0]Use HashMap or one of the specialized versions (LongMap, AnyRefMap) instead of OpenHashMap[Since version 2.13.0]Use Stack instead of ArrayStack; it now uses an array-based implementation[Since version 2.13.0]GrowingBuilder has been renamed to GrowableBuilder[Since version 2.13.0]IndexedOptimizedBuffer has been renamed to IndexedBuffer[Since version 2.13.0]IndexedOptimizedSeq has been renamed to IndexedSeq[Since version 2.13.0]mutable.LinearSeq has been removed; use LinearSeq with mutable.Seq instead[Since version 2.13.0]Use Iterable instead of Traversable[Since version 2.13.0]Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays[Since version 2.13.0]Use Stack instead of ArrayStack; it now uses an array-based implementation[Since version 2.13.0]Use Iterable instead of Traversable[Since version 2.13.0]Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays