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.
the type of this arraybuffer's elements.
1
"Scala's Collection Library overview" section on Array Buffers
for more information.
A builder class for arrays.
the type of the elements for the builder.
2.8
A common supertrait of ArrayOps
and WrappedArray
that factors out the deep
method for arrays and wrapped arrays and serves as a marker trait for array wrappers.
type of the elements contained in the array like object.
the type of the actual collection containing the elements.
This class serves as a wrapper for Array
s with all the operations found in indexed sequences. Where needed, instances of arrays are implicitly converted into this class.
The difference between this class and WrappedArray
is that calling transformer methods such as filter
and map
will yield an array, whereas a WrappedArray
will remain a WrappedArray
.
type of the elements contained in this array.
2.8
A class for polymorphic arrays of elements that's represented internally by an array of objects. This means that elements of primitive types are boxed.
type of the elements contained in this array sequence.
2.8
"Scala's Collection Library overview" section on Array Sequences
for more information.
Simple stack class backed by an array. Should be significantly faster than the standard mutable stack.
type of the elements contained in this array stack.
2.7
"Scala's Collection Library overview" section on Array Stacks
for more information.
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 memory footprint of a bitset is determined by the largest number stored in it.
"Scala's Collection Library overview" section on Mutable Bitsets
for more information.
Buffers are used to create sequences of elements incrementally by appending, prepending, or inserting new elements. It is also possible to access and modify elements in a random access fashion via the index of the element in the current sequence.
type of the elements contained in this buffer.
1
A template trait for buffers of type Buffer[A]
.
Buffers are used to create sequences of elements incrementally by appending, prepending, or inserting new elements. It is also possible to access and modify elements in a random access fashion via the index of the element in the current sequence.
the type of the elements of the buffer
the type of the buffer itself.
2.8
This trait provides most of the operations of a Buffer
independently of its representation. It is typically inherited by concrete implementations of buffers. To implement a concrete buffer, you need to provide implementations of the following methods:
def apply(idx: Int): A def update(idx: Int, elem: A) def length: Int def clear() def +=(elem: A): this.type def +=:(elem: A): this.type def insertAll(n: Int, iter: Traversable[A]) def remove(n: Int): A
The base trait of all builders. A builder lets one construct a collection incrementally, by adding elements to the builder with +=
and then converting to the required collection type with result
.
One cannot assume that a single Builder
can build more than one instance of the desired collection. Particular subclasses may allow such behavior. Otherwise, result
should be treated as a terminal operation: after it is called, no further methods should be called on the builder. Extend the collection.mutable.ReusableBuilder trait instead of Builder
for builders that may be reused to build multiple instances.
the type of elements that get added to the builder.
the type of collection that it produced.
2.8
A trait for cloneable collections.
Type of the elements contained in the collection, covariant and with reference types as upperbound.
2.8
Class used internally for default map model.
2.3
An implementation class backing a HashSet
.
This trait is used internally. It can be mixed in with various collections relying on hash table as an implementation.
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.
2.8
Class used internally.
2.8
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.
1
"Scala's Collection Library overview" section on Hash Tables
for more information.
This class implements mutable sets using a hashtable.
1
"Scala's Collection Library overview" section on Hash Tables
for more information.
This class can be used to construct data structures that are based on hashtables. Class HashTable[A]
implements a hashtable that maps keys of type A
to values of the fully abstract member type Entry
. Classes that make use of HashTable
have to provide an implementation for Entry
.
There are mainly two parameters that affect the performance of a hashtable: the initial size and the load factor. The size refers to the number of buckets in the hashtable, and the load factor is a measure of how full the hashtable is allowed to get before its size is automatically doubled. Both parameters may be changed by overriding the corresponding values in class HashTable
.
type of the elements contained in this hash table.
1
History[A, B]
objects may subscribe to events of type A
published by an object of type B
. The history subscriber object records all published events up to maximum number of maxHistory
events.
Type of events.
Type of publishers.
1
A subtrait of scala.collection.IndexedSeq which represents sequences that can be mutated.
It declares a method update
which allows updating an element at a specific index in the sequence.
This trait just implements iterator
in terms of apply
and length
. However, see IndexedSeqOptimized
for an implementation trait that overrides operations to make them run faster under the assumption of fast random access with apply
.
the element type of the mutable indexed sequence
the type of the actual mutable indexed sequence containing the elements.
A subtrait of scala.collection.IndexedSeq which represents sequences that can be mutated.
2.8
A non-strict view of a mutable IndexedSeq
.
A view is a lazy version of some collection. Collection transformers such as map
or filter
or ++
do not traverse any elements when applied on a view. Instead they create a new view which simply records that fact that the operation needs to be applied. The collection elements are accessed, and the view operations are applied, when a non-view result is needed, or when the force
method is called on a view. Some of the operations of this class will yield again a mutable indexed sequence, others will just yield a plain indexed sequence of type collection.IndexedSeq
. Because this is a leaf class there is no associated Like
class.
the element type of the view
the type of the underlying collection containing the elements.
2.8
A base trait for iterable collections that can be mutated.
This is a base trait for all mutable Scala collections that define an iterator
method to step through one-by-one the collection's elements. Implementations of this trait need to provide a concrete method with signature:
def iterator: Iterator[A]
They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
This trait implements Iterable
's foreach
method by stepping through all elements using iterator
. Subclasses should re-implement foreach
with something more efficient, if possible.
This trait adds methods iterator
, sameElements
, takeRight
, dropRight
to the methods inherited from trait `Traversable`.
Note: This trait replaces every method that uses break
in TraversableLike
by an iterator version.
A builder that constructs its result lazily. Iterators or iterables to be added to this builder with ++=
are not evaluated until result
is called.
This builder can be reused.
type of the elements for this builder.
type of the collection this builder builds.
2.8
A subtrait of collection.LinearSeq
which represents sequences that can be mutated.
Linear sequences have reasonably efficient head
, tail
, and isEmpty
methods. If these methods provide the fastest way to traverse the collection, a collection Coll
that extends this trait should also extend LinearSeqOptimized[A, Coll[A]]
.
Class for the linked hash map entry, used internally.
2.8
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 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.
1
A Buffer
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.
1
"Scala's Collection Library overview" section on List Buffers
for more information.
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.
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.
A base trait for maps that can be mutated.
Implementation note: This trait provides most of the operations of a mutable Map
independently of its representation. It is typically inherited by concrete implementations of maps.
To implement a concrete mutable map, you need to provide implementations of the following methods:
def get(key: K): Option[V] def iterator: Iterator[(K, V)] def += (kv: (K, V)): This def -= (key: K): This
If you wish that methods like take
, drop
, filter
also return the same kind of map you should also override:
def empty: This
It is also good idea to override methods foreach
and size
for efficiency.
1.0
The canonical builder for immutable maps, working with the map's +
method to add new elements. Collections are built from their empty
element using this + method.
Type of the keys for the map this builder creates.
Type of the values for the map this builder creates.
The type of the actual collection this builder builds.
2.8
A template trait for mutable maps.
Implementation note: This trait provides most of the operations of a mutable Map
independently of its representation. It is typically inherited by concrete implementations of maps.
To implement a concrete mutable map, you need to provide implementations of the following methods:
def get(key: K): Option[V] def iterator: Iterator[(K, V)] def += (kv: (K, V)): This def -= (key: K): This
If you wish that methods like take
, drop
, filter
also return the same kind of map you should also override:
def empty: This
It is also good idea to override methods foreach
and size
for efficiency.
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 A
to Set[B]
objects into multimaps that map A
to B
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` 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
This class is used internally to represent mutable lists. It is the basis for the implementation of the class Queue
.
1
A mutable hash map based on an open hashing scheme. 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.
2.7
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 of the elements in this priority queue.
val pq = collection.mutable.PriorityQueue(1, 2, 5, 3, 7) println(pq) // elements probably not in order println(pq.clone.dequeueAll) // prints Vector(7, 5, 3, 2, 1)
1
Publisher[A,This]
objects publish events of type A
to all registered subscribers. When subscribing, a subscriber may specify a filter which can be used to constrain the number of events sent to the subscriber. Subscribers may suspend their subscription, or reactivate a suspended subscription. Class Publisher
is typically used as a mixin. The abstract type Pub
models the type of the publisher itself.
type of the published event.
1
Queue
objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.
1
"Scala's Collection Library overview" section on Queues
for more information.
This class is used internally to implement data structures that are based on resizable arrays.
type of the elements contained in this resizable array.
1
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.
It is up to subclasses to implement this behavior, and to document any other behavior that varies from standard ReusableBuilder
usage (e.g. operations being well-defined after a call to result
, or allowing multiple calls to result 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.
2.12
A revertible history is a History
object which supports an undo operation. Type variable Evt
refers to the type of the published events, Pub
denotes the publisher type. Type Pub
is typically a subtype of Publisher
.
type of the events
type of the publisher
2.8
A subtrait of collection.Seq
which represents sequences that can be mutated.
Sequences are special cases of iterable collections of class Iterable
. Unlike iterables, sequences always have a defined order of elements. Sequences provide a method apply
for indexing. Indices range from 0
up to the length
of a sequence. Sequences support a number of methods to find occurrences of elements or subsequences, including segmentLength
, prefixLength
, indexWhere
, indexOf
, lastIndexWhere
, lastIndexOf
, startsWith
, endsWith
, indexOfSlice
.
Another way to see a sequence is as a PartialFunction
from Int
values to the element type of the sequence. The isDefinedAt
method of a sequence returns true
for the interval from 0
until length
.
Sequences can be accessed in reverse order of their elements, using methods reverse
and reverseIterator
.
Sequences have two principal subtraits, IndexedSeq
and LinearSeq
, which give different guarantees for performance. An IndexedSeq
provides fast random-access of elements and a fast length
operation. A LinearSeq
provides fast access only to the first element via head
, but also has a fast tail
operation.
The class adds an update
method to collection.Seq
.
A template trait for mutable sequences of type mutable.Seq[A]
.
the type of the elements of the set
the type of the set itself.
A generic trait for mutable sets.
To implement a concrete mutable set, you need to provide implementations of the following methods:
def contains(elem: A): Boolean def iterator: Iterator[A] def += (elem: A): this.type def -= (elem: A): this.type
If you wish that methods like take
, drop
, filter
return the same kind of set, you should also override:
def empty: This
It is also good idea to override methods foreach
and size
for efficiency.
1.0
The canonical builder for mutable Sets.
The type of the elements that will be contained in this set.
The type of the actual collection this set builds.
2.8
A template trait for mutable sets of type mutable.Set[A]
.
This trait provides most of the operations of a mutable.Set
independently of its representation. It is typically inherited by concrete implementations of sets.
To implement a concrete mutable set, you need to provide implementations of the following methods:
def contains(elem: A): Boolean def iterator: Iterator[A] def += (elem: A): this.type def -= (elem: A): this.type
If you wish that methods like take
, drop
, filter
return the same kind of set, you should also override:
def empty: This
It is also good idea to override methods foreach
and size
for efficiency.
the type of the elements of the set
the type of the set itself.
2.8
A mutable map whose keys are sorted.
the type of the keys contained in this sorted map.
the type of the values associated with the keys.
2.12
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.)
2.7
Subscriber[A, B]
objects may subscribe to events of type A
published by an object of type B
. B
is typically a subtype of scala.collection.mutable.Publisher.
1
A trait for traversable collections that can be mutated.
This is a base trait of all kinds of mutable Scala collections. It implements the behavior common to all collections, in terms of a method foreach
with signature:
def foreach[U](f: Elem => U): Unit
Collection classes mixing in this trait provide a concrete foreach
method which traverses all the elements contained in the collection, applying a given function to each. They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
A traversable class might or might not have two properties: strictness and orderedness. Neither is represented as a type.
The instances of a strict collection class have all their elements computed before they can be used as values. By contrast, instances of a non-strict collection class may defer computation of some of their elements until after the instance is available as a value. A typical example of a non-strict collection class is a scala.collection.immutable.Stream. A more general class of examples are TraversableViews
.
If a collection is an instance of an ordered collection class, traversing its elements with foreach
will always visit elements in the same order, even for different runs of the program. If the class is not ordered, foreach
can visit elements in different orders for different runs (but it will keep the same order in the same run).'
A typical example of a collection class which is not ordered is a HashMap
of objects. The traversal order for hash maps will depend on the hash codes of its elements, and these hash codes might differ from one run to the next. By contrast, a LinkedHashMap
is ordered because its foreach
method visits elements in the order they were inserted into the HashMap
.
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.
2.12
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.
2.10
Classes that mix in the Undoable
class provide an operation undo
which can be used to undo the last operation.
1
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:
concat
)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. Entries are removed from this map when the key is no longer (strongly) referenced. This class wraps java.util.WeakHashMap
.
type of keys contained in this map
type of values associated with the keys
2.8
"Scala's Collection Library overview" section on Weak Hash Maps
for more information.
A class representing Array[T]
.
type of the elements in this wrapped array.
2.8
A builder class for arrays.
This builder can be reused.
type of elements that can be added to this builder.
2.8
This is a simple proxy class for `scala.collection.mutable.Buffer`. It is most useful for assembling customized set abstractions dynamically using object composition and forwarding.
type of the elements the buffer proxy contains.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
This class is used internally. It implements the mutable Map
class in terms of three functions: findEntry
, addEntry
, and entries
.
(Since version 2.11.0) this trait will be removed
1
This class implements double linked lists where both the head (elem
), the tail (next
) and a reference to the previous node (prev
) are mutable.
the type of the elements contained in this double linked list.
(Since version 2.11.0) low-level linked lists are deprecated due to idiosyncrasies in interface and incomplete features
1
"Scala's Collection Library overview" section on Double Linked Lists
for more information.
This extensible class may be used as a basis for implementing double linked lists. Type variable A
refers to the element type of the list, type variable This
is used to model self types of linked lists.
The invariant of this data structure is that prev
is always a reference to the previous node in the list. If this
is the first node of the list, prev
will be null
. Field next
is set to this
iff the list is empty.
Examples (right arrow represents next
, left arrow represents prev
, _
represents no value):
Empty: null <-- [ _ ] --, [ ] <-` Single element: null <-- [ x ] --> [ _ ] --, [ ] <-- [ ] <-` More elements: null <-- [ x ] --> [ y ] --> [ z ] --> [ _ ] --, [ ] <-- [ ] <-- [ ] <-- [ ] <-`
type of the elements contained in the double linked list
the type of the actual linked list holding the elements
(Since version 2.11.0) low-level linked lists are deprecated due to idiosyncrasies in interface and incomplete features
2.8
This class can be used as an adaptor to create mutable maps from immutable map implementations. Only method empty
has to be redefined if the immutable map on which this mutable map is originally based is not empty. empty
is supposed to return the representation of an empty map.
(Since version 2.11.0) adaptors are inherently unreliable and prone to performance problems
1
This class can be used as an adaptor to create mutable sets from immutable set implementations. Only method empty
has to be redefined if the immutable set on which this mutable set is originally based is not empty. empty
is supposed to return the representation of an empty set.
(Since version 2.11.0) adaptors are inherently unreliable and prone to performance problems
1
A more traditional/primitive style of linked list where the "list" is also the "head" link. Links can be manually created and manipulated, though the use of the API, when possible, is recommended.
The danger of directly manipulating next:
scala> val b = LinkedList(1) b: scala.collection.mutable.LinkedList[Int] = LinkedList(1) scala> b.next = null scala> println(b) java.lang.NullPointerException
If the list is empty next
must be set to this
. The last node in every mutable linked list is empty.
Examples (_
represents no value):
Empty: [ _ ] --, [ ] <-` Single element: [ x ] --> [ _ ] --, [ ] <-` More elements: [ x ] --> [ y ] --> [ z ] --> [ _ ] --, [ ] <-`
the type of the elements contained in this linked list.
(Since version 2.11.0) low-level linked lists are deprecated due to idiosyncrasies in interface and incomplete features
1
"Scala's Collection Library overview" section on Linked Lists
for more information.
This extensible class may be used as a basis for implementing linked list. Type variable A
refers to the element type of the list, type variable This
is used to model self types of linked lists.
If the list is empty next
must be set to this
. The last node in every mutable linked list is empty.
Examples (_
represents no value):
Empty: [ _ ] --, [ ] <-` Single element: [ x ] --> [ _ ] --, [ ] <-` More elements: [ x ] --> [ y ] --> [ z ] --> [ _ ] --, [ ] <-`
type of the elements contained in the linked list
the type of the actual linked list holding the elements
(Since version 2.11.0) low-level linked lists are deprecated due to idiosyncrasies in interface and incomplete features
2.8
This trait implements a proxy for scala.collection.mutable.Map.
It is most useful for assembling customized map abstractions dynamically using object composition and forwarding.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
This class is typically used as a mixin. It adds a subscription mechanism to the Buffer
class into which this abstract class is mixed in. Class ObservableBuffer
publishes events of the type Message
.
(Since version 2.11.0) observables are deprecated because scripting is deprecated
1
This class is typically used as a mixin. It adds a subscription mechanism to the Map
class into which this abstract class is mixed in. Class ObservableMap
publishes events of the type Message
.
(Since version 2.11.0) observables are deprecated because scripting is deprecated
1
This class is typically used as a mixin. It adds a subscription mechanism to the Set
class into which this abstract class is mixed in. Class ObservableSet
publishes events of the type Message
.
(Since version 2.11.0) observables are deprecated because scripting is deprecated
1
This class servers as a proxy for priority queues. The elements of the queue have to be ordered in terms of the Ordered[T]
class.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
Queue
objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.
type of the elements in this queue proxy.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
This is a simple wrapper class for scala.collection.mutable.Set. It is most useful for assembling customized set abstractions dynamically using object composition and forwarding.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
type of the elements contained in this stack.
(Since version 2.12.0) Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
1
"Scala's Collection Library overview" section on Stacks
for more information.
A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
type of the elements in this stack proxy.
(Since version 2.11.0) proxying is deprecated due to lack of use and compiler-level support
1
This class should be used as a mixin. It synchronizes the Buffer
methods of the class into which it is mixed in.
type of the elements contained in this buffer.
(Since version 2.11.0) Synchronization via traits is deprecated as it is inherently unreliable. Consider java.util.concurrent.ConcurrentLinkedQueue as an alternative.
1
This class should be used as a mixin. It synchronizes the Map
functions of the class into which it is mixed in.
type of the keys contained in this map.
type of the values associated with keys.
(Since version 2.11.0) Synchronization via traits is deprecated as it is inherently unreliable. Consider java.util.concurrent.ConcurrentHashMap as an alternative.
1
This class implements synchronized priority queues using a binary heap. The elements of the queue have to be ordered in terms of the Ordered[T]
class.
type of the elements contained in this synchronized priority queue
(Since version 2.11.0) Comprehensive synchronization via selective overriding of methods is inherently unreliable. Consider java.util.concurrent.ConcurrentSkipListSet as an alternative.
1
This is a synchronized version of the Queue[T]
class. It implements a data structure that allows one to insert and retrieve elements in a first-in-first-out (FIFO) manner.
type of elements contained in this synchronized queue.
(Since version 2.11.0) Synchronization via selective overriding of methods is inherently unreliable. Consider java.util.concurrent.ConcurrentLinkedQueue as an alternative.
1
This class should be used as a mixin. It synchronizes the Set
functions of the class into which it is mixed in.
type of the elements contained in this synchronized set.
(Since version 2.11.0) Synchronization via traits is deprecated as it is inherently unreliable. Consider java.util.concurrent.ConcurrentHashMap[A,Unit] as an alternative.
1
This is a synchronized version of the Stack[T]
class. It implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
type of the elements contained in this stack.
(Since version 2.11.0) Synchronization via selective overriding of methods is inherently unreliable. Consider java.util.concurrent.LinkedBlockingDequeue instead.
1
Factory object for the ArrayBuffer
class.
This object provides a set of operations to create
values. ArrayBuffer
A companion object for array builders.
2.8
A companion object for ArrayOps
.
2.8
Factory object for the ArrayStack
class.
This object provides a set of operations to create
values. ArrayStack
This object provides a set of operations to create
values. The current default implementation of a mutable.IndexedSeq
mutable.IndexedSeq
is an ArrayBuffer
.
An object containing the necessary implicit definitions to make SeqView
s work. Its definitions are generally not accessed directly by clients.
Note that the canBuildFrom
factories yield SeqView
s, not IndexedSeqView
s. This is intentional, because not all operations yield again a mutable.IndexedSeqView
. For instance, map
just gives a SeqView
, which reflects the fact that map
cannot do its work and maintain a pointer into the original indexed sequence.
This object provides a set of operations to create
values. The current default implementation of a mutable.Iterable
mutable.Iterable
is an ArrayBuffer
.
This object provides a set of operations to create
values. The current default implementation of a mutable.LinearSeq
mutable.LinearSeq
is a MutableList
.
This object provides a set of operations needed to create
values. The current default implementation of a mutable.Map
mutable.Map
is a HashMap
.
This object provides a set of operations to create
values. The current default implementation of a mutable.Seq
mutable.Seq
is an ArrayBuffer
.
This object provides a set of operations needed to create
values. The current default implementation of a mutable.Set
mutable.Set
is a HashSet
.
Factory object for the mutable.Stack
class.
This object provides a set of operations to create
values. mutable.Stack
This object provides a set of operations to create
values. The current default implementation of a mutable.Traversable
mutable.Traversable
is an ArrayBuffer
.
© 2002-2019 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://www.scala-lang.org/api/2.12.9/scala/collection/mutable/index.html
This class implements mutable maps with
AnyRef
keys based on a hash table with open addressing.Basic map operations on single entries, including
contains
andget
, are typically significantly faster withAnyRefMap
than HashMap. 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, including
foreach
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. Although
AnyRefMap
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.