scala.collection.mutable
Members list
Type members
Classlikes
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.
Attributes
- Source
- Buffer.scala
- Supertypes
-
trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]Show all
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
-
trait Iterable[A]class AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class PriorityQueue[A]
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
- 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
-
trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass StringBuilderShow 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
-
trait Set[A]trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneabletrait Iterable[A]class AbstractSet[A]trait Set[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
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.
Attributes
- Companion
- object
- Source
- AnyRefMap.scala
- Supertypes
-
trait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow all
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 parameters
- A
-
the type of this arraybuffer's elements.
Attributes
- See also
-
"Scala's Collection Library overview" section on
Array Buffers
for more information. - Companion
- object
- Source
- ArrayBuffer.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait IndexedBuffer[A]trait IndexedSeq[A]trait IndexedSeq[A]class AbstractBuffer[A]trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
Factory object for the ArrayBuffer
class.
Factory object for the ArrayBuffer
class.
This object provides a set of operations to create Iterable
values.
Attributes
- Companion
- class
- Source
- ArrayBuffer.scala
- Supertypes
-
trait SeqFactory[ArrayBuffer]trait IterableFactory[ArrayBuffer]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
ArrayBuffer.type
Attributes
- Source
- ArrayBuffer.scala
- Supertypes
-
class AbstractIndexedSeqView[A]trait IndexedSeqView[A]class AbstractSeqView[A]trait SeqView[A]class AbstractView[A]trait View[A]trait Serializableclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
A builder class for arrays.
A builder class for arrays.
Type parameters
- T
-
the type of the elements for the builder.
Attributes
- Companion
- object
- Source
- ArrayBuilder.scala
- Supertypes
- Known subtypes
A companion object for array builders.
A companion object for array builders.
Attributes
- Companion
- class
- Source
- ArrayBuilder.scala
- Supertypes
- Self type
-
ArrayBuilder.type
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.
Type parameters
- A
-
the type of this ArrayDeque's elements.
Attributes
- Note
-
Subclasses must override the
ofArray
protected method to return a more specific type. - Companion
- object
- Source
- ArrayDeque.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait IndexedBuffer[A]trait IndexedSeq[A]trait IndexedSeq[A]class AbstractBuffer[A]trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- 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
- class
- Source
- ArrayDeque.scala
- Supertypes
-
trait SeqFactory[ArrayDeque]trait IterableFactory[ArrayDeque]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
ArrayDeque.type
Attributes
- Source
- ArrayDeque.scala
- Supertypes
- Known subtypes
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 parameters
- T
-
type of the elements in this wrapped array.
Attributes
- Companion
- object
- Source
- ArraySeq.scala
- Supertypes
-
trait Serializabletrait IndexedSeq[T]trait IndexedSeq[T]class AbstractSeq[T]trait Seq[T]trait Cloneabletrait Iterable[T]class AbstractSeq[T]trait Seq[T]trait Equalsclass AbstractIterable[T]trait Iterable[T]trait IterableOnce[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
A companion object used to create instances of ArraySeq
.
A companion object used to create instances of ArraySeq
.
Attributes
- Companion
- class
- Source
- ArraySeq.scala
- Supertypes
-
trait ClassTagSeqFactory[ArraySeq]trait ClassTagIterableFactory[ArraySeq]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
ArraySeq.type
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.
Attributes
- See also
-
"Scala's Collection Library overview" section on
Mutable Bitsets
for more information. - Companion
- object
- Source
- BitSet.scala
- Supertypes
-
trait Serializabletrait BitSetclass AbstractSet[Int]trait Shrinkable[Int]trait Clearabletrait Cloneableclass AbstractSet[Int]trait Equalsclass AbstractIterable[Int]trait IterableOnce[Int]class Objecttrait Matchableclass AnyShow all
A Buffer
is a growable and shrinkable Seq
.
A Buffer
is a growable and shrinkable Seq
.
Attributes
- Companion
- object
- Source
- Buffer.scala
- Supertypes
- Known subtypes
-
class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]Show all
Attributes
- Companion
- trait
- Source
- Buffer.scala
- Supertypes
-
trait SeqFactory[Buffer]trait IterableFactory[Buffer]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Buffer.type
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
.
Attributes
- See also
-
scala.collection.mutable.ReusableBuilder for Builders which can be reused after calling
result()
- Source
- Builder.scala
- Supertypes
- Known subtypes
-
class LongMap[V]class SystemPropertiesclass PriorityQueue[A]class VectorBuilder[A]class ArrayBuilder[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass ListBuffer[A]class LongMapBuilder[V]class StringBuilderclass HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]class UnrolledBuffer[T]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorShow all
- Self type
-
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.
Attributes
- Source
- Growable.scala
- Supertypes
- Known subtypes
-
trait Growable[A]trait Buffer[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]class LongMap[V]class SystemPropertiesclass PriorityQueue[A]class VectorBuilder[A]class ArrayBuilder[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass LongMapBuilder[V]class StringBuilderclass HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorShow all
A trait for cloneable collections.
A trait for cloneable collections.
Type parameters
- C
-
Type of the collection, covariant and with reference types as upperbound.
Attributes
- Source
- Cloneable.scala
- Supertypes
- Known subtypes
-
class ArrayDeque[A]class Queue[A]class Stack[A]class LongMap[V]class SystemPropertiesclass PriorityQueue[A]trait Buffer[A]class AbstractBuffer[A]class ArrayBuffer[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnittrait IndexedSeq[T]class StringBuildertrait Seq[A]class AbstractSeq[A]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorclass HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]Show all
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
).
Attributes
- See also
-
"Scala's Collection Library overview" section on
Hash Tables
for more information. - Companion
- object
- Source
- CollisionProofHashMap.scala
- Supertypes
This object provides a set of operations to create Iterable
values.
This object provides a set of operations to create Iterable
values.
Attributes
- Companion
- class
- Source
- CollisionProofHashMap.scala
- Supertypes
- Self type
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.
Attributes
- Companion
- object
- Source
- Growable.scala
- Supertypes
- Known subtypes
-
trait Buffer[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]class LongMap[V]class SystemPropertiesclass PriorityQueue[A]class VectorBuilder[A]class ArrayBuilder[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass LongMapBuilder[V]class StringBuilderclass HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorShow all
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.
Attributes
- Source
- GrowableBuilder.scala
- Supertypes
This class implements mutable maps using a hashtable.
This class implements mutable maps using a hashtable.
Type parameters
- K
-
the type of the keys contained in this hash map.
- V
-
the type of the values assigned to keys in this hash map.
Attributes
- See also
-
"Scala's Collection Library overview" section on
Hash Tables
for more information. - Companion
- object
- Source
- HashMap.scala
- Supertypes
-
trait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow 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
- class
- Source
- HashMap.scala
- Supertypes
- Self type
-
HashMap.type
This class implements mutable sets using a hashtable.
This class implements mutable sets using a hashtable.
Attributes
- See also
-
"Scala's Collection Library overview" section on
Hash Tables
for more information. - Companion
- object
- Source
- HashSet.scala
- Supertypes
-
trait Serializableclass AbstractSet[A]trait Set[A]trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneabletrait Iterable[A]class AbstractSet[A]trait Set[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow 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
- class
- Source
- HashSet.scala
- Supertypes
- Self type
-
HashSet.type
Reusable builder for immutable collections
Attributes
- Companion
- object
- Source
- Buffer.scala
- Supertypes
-
trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearabletrait IndexedSeq[A]trait IndexedSeq[A]trait Seq[A]trait Cloneabletrait Seq[A]trait Equalstrait Iterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Companion
- trait
- Source
- Buffer.scala
- Supertypes
-
class Delegate[IndexedBuffer]trait SeqFactory[IndexedBuffer]trait IterableFactory[IndexedBuffer]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
IndexedBuffer.type
Attributes
- Companion
- object
- Source
- IndexedSeq.scala
- Supertypes
- Known subtypes
-
class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnittrait IndexedBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class StringBuilderShow all
Attributes
- Companion
- trait
- Source
- IndexedSeq.scala
- Supertypes
-
class Delegate[IndexedSeq]trait SeqFactory[IndexedSeq]trait IterableFactory[IndexedSeq]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
IndexedSeq.type
Attributes
- Source
- IndexedSeq.scala
- Supertypes
- Known subtypes
-
class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnittrait IndexedBuffer[A]trait IndexedSeq[T]class StringBuilderShow all
Attributes
- Companion
- object
- Source
- Iterable.scala
- Supertypes
- Known subtypes
-
class AbstractIterable[A]class PriorityQueue[A]class LongMap[V]class SystemPropertiestrait Seq[A]class AbstractSeq[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass StringBuildertrait Buffer[A]trait IndexedBuffer[A]trait IndexedSeq[T]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatortrait Set[A]class AbstractSet[A]class BitSetclass HashSet[A]class LinkedHashSet[A]class TreeSet[A]trait SortedSet[A]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
- Iterable.scala
- Supertypes
- Self type
-
Iterable.type
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 parameters
- K
-
the type of the keys contained in this hash map.
- V
-
the type of the values assigned to keys in this hash map.
Attributes
- Companion
- object
- Source
- LinkedHashMap.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow 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
- class
- Source
- LinkedHashMap.scala
- Supertypes
- Self type
-
LinkedHashMap.type
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 parameters
- A
-
the type of the elements contained in this set.
Attributes
- Companion
- object
- Source
- LinkedHashSet.scala
- Supertypes
-
trait DefaultSerializabletrait Serializableclass AbstractSet[A]trait Set[A]trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneabletrait Iterable[A]class AbstractSet[A]trait Set[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow 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
- class
- Source
- LinkedHashSet.scala
- Supertypes
- Self type
-
LinkedHashSet.type
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 parameters
- A
-
the type of this list buffer's elements.
Attributes
- See also
-
"Scala's Collection Library overview" section on
List Buffers
for more information. - Companion
- object
- Source
- ListBuffer.scala
- Supertypes
-
trait DefaultSerializabletrait Serializableclass AbstractBuffer[A]trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Source
- ListBuffer.scala
- Supertypes
-
trait SeqFactory[ListBuffer]trait IterableFactory[ListBuffer]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
ListBuffer.type
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.
Attributes
- Companion
- object
- Source
- LongMap.scala
- Supertypes
-
trait Serializabletrait Shrinkable[Long]trait Clearabletrait Cloneabletrait Equalsclass Objecttrait Matchableclass AnyShow all
Base type of mutable Maps
Base type of mutable Maps
Attributes
This object provides a set of operations to create Iterable
values.
Attributes
- Source
- Map.scala
- Supertypes
- Known subtypes
A heap-based priority queue.
A heap-based priority queue.
To prioritize elements of type A
there must be an implicit Ordering[A]
available at creation. Elements are retrieved in priority order by using dequeue or dequeueAll.
If multiple elements have the same priority as determined by the ordering for this PriorityQueue
, no guarantees are made regarding the order in which those elements are returned by dequeue
or dequeueAll
. 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 the dequeue
and dequeueAll
methods will return elements in priority order (while removing elements from the heap). Standard collection methods such as drop
, iterator
, toList
and toString
use an arbitrary iteration order: they will traverse the heap or remove elements in whichever order seems most convenient.
Therefore, printing a PriorityQueue
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 to dequeue
them. To do this non-destructively, duplicate the PriorityQueue
first; the clone
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 that clone 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 order
val res0: List[Int] = List(7, 3, 5, 1, 2)
scala> pq.clone.dequeueAll
val res1: Seq[Int] = ArraySeq(7, 5, 3, 2, 1)
Type parameters
- A
-
type of the elements in this priority queue.
Value parameters
- ord
-
implicit ordering used to compare the elements of type
A
.
Attributes
- Companion
- object
- Source
- PriorityQueue.scala
- Supertypes
-
trait Serializabletrait Cloneabletrait Growable[A]trait Clearableclass AbstractIterable[A]trait Iterable[A]class AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Source
- PriorityQueue.scala
- Supertypes
- Self type
-
PriorityQueue.type
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.
Attributes
- Companion
- object
- Source
- Queue.scala
- Supertypes
-
class ArrayDeque[A]trait DefaultSerializabletrait Serializabletrait IndexedBuffer[A]trait IndexedSeq[A]trait IndexedSeq[A]class AbstractBuffer[A]trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow 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
- class
- Source
- Queue.scala
- Supertypes
-
trait StrictOptimizedSeqFactory[Queue]trait SeqFactory[Queue]trait IterableFactory[Queue]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Queue.type
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 parameters
- Elem
-
the type of elements that get added to the builder.
- To
-
the type of collection that it produced.
Attributes
- Source
- ReusableBuilder.scala
- Supertypes
- Known subtypes
-
class VectorBuilder[A]class ArrayBuilder[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass ListBuffer[A]class LongMapBuilder[V]class StringBuilderShow all
Attributes
- Companion
- object
- Source
- Seq.scala
- Supertypes
- Known subtypes
-
class AbstractSeq[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass StringBuildertrait Buffer[A]trait IndexedBuffer[A]trait IndexedSeq[T]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorShow 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
- Seq.scala
- Supertypes
-
trait SeqFactory[Seq]trait IterableFactory[Seq]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Seq.type
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 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
- Known subtypes
-
Attributes
- Companion
- trait
- Source
- SeqMap.scala
- Supertypes
- Self type
-
SeqMap.type
Attributes
- Source
- Seq.scala
- Supertypes
- Known subtypes
-
trait Buffer[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]class ArraySeq[T]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnittrait IndexedSeq[T]class StringBuildertrait Seq[A]class AbstractSeq[A]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorShow all
Base trait for mutable sets
Base trait for mutable sets
Attributes
- Companion
- object
- Source
- Set.scala
- Supertypes
- Known subtypes
-
class AbstractSet[A]class BitSetclass HashSet[A]class LinkedHashSet[A]class TreeSet[A]trait SortedSet[A]Show all
This object provides a set of operations to create Iterable
values.
Attributes
- Source
- Set.scala
- Supertypes
-
trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneable[C]trait Cloneabletrait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]Show all
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.
Attributes
- Source
- Shrinkable.scala
- Supertypes
- Known subtypes
-
trait Buffer[A]class AbstractBuffer[A]class ArrayBuffer[A]class ArrayDeque[A]class Queue[A]class Stack[A]class ListBuffer[A]class UnrolledBuffer[T]trait IndexedBuffer[A]class LongMap[V]class SystemPropertiesclass HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]Show all
Base type for mutable sorted map collections
Base type for mutable sorted map collections
Attributes
- Companion
- object
- Source
- SortedMap.scala
- Supertypes
- Known subtypes
-
Attributes
- Companion
- trait
- Source
- SortedMap.scala
- Supertypes
-
trait SortedMapFactory[SortedMap]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
SortedMap.type
Attributes
- Source
- SortedMap.scala
- Supertypes
- Known subtypes
Base type for mutable sorted set collections
Base type for mutable sorted set collections
Attributes
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
- SortedSet.scala
- Supertypes
-
trait SortedIterableFactory[SortedSet]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
SortedSet.type
Attributes
- Source
- SortedSet.scala
- Supertypes
-
trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneable[C]trait Cloneabletrait IterableOnce[A]class Objecttrait Matchableclass AnyShow all
- Known subtypes
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 parameters
- A
-
type of the elements contained in this stack.
Attributes
- Companion
- object
- Source
- Stack.scala
- Supertypes
-
class ArrayDeque[A]trait DefaultSerializabletrait Serializabletrait IndexedBuffer[A]trait IndexedSeq[A]trait IndexedSeq[A]class AbstractBuffer[A]trait Buffer[A]trait Shrinkable[A]trait Growable[A]trait Clearableclass AbstractSeq[A]trait Seq[A]trait Cloneabletrait Iterable[A]class AbstractSeq[A]trait Seq[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow 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
- class
- Source
- Stack.scala
- Supertypes
-
trait StrictOptimizedSeqFactory[Stack]trait SeqFactory[Stack]trait IterableFactory[Stack]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Stack.type
A builder of String
which is also a mutable sequence of characters.
A builder of String
which is also a 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: reverse produces a new StringBuilder
, and reverseInPlace mutates this builder.
Mutating operations return either this.type
, i.e., the current builder, or Unit
.
Other methods extract data or information from the builder without mutating it.
The distinction is also reflected in naming conventions used by collections, such as append
, which mutates, and appended
, which does not, or reverse
, which does not mutate, and reverseInPlace
, which does.
The String
result may be obtained using either result()
or toString
.
This Builder can be reused after calling result()
without an intermediate call to clear()
in order to build multiple related results.
Attributes
- See also
-
"Scala's Collection Library overview" section on
StringBuilders
for more information. - Companion
- object
- Source
- StringBuilder.scala
- Supertypes
-
trait Serializabletrait CharSequencetrait IndexedSeq[Char]trait IndexedSeq[Char]trait Clearableclass AbstractSeq[Char]trait Cloneable[StringBuilder]trait Cloneableclass AbstractSeq[Char]trait Equalsclass AbstractIterable[Char]trait IterableOnce[Char]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Source
- StringBuilder.scala
- Supertypes
- Self type
-
StringBuilder.type
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 parameters
- K
-
the type of the keys contained in this tree map.
- V
-
the type of the values associated with the keys.
Value parameters
- ordering
-
the implicit ordering used to compare objects of type
A
.
Attributes
- Companion
- object
- Source
- TreeMap.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow 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
- class
- Source
- TreeMap.scala
- Supertypes
- Self type
-
TreeMap.type
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 parameters
- A
-
the type of the keys contained in this tree set.
Value parameters
- ordering
-
the implicit ordering used to compare objects of type
A
.
Attributes
- Companion
- object
- Source
- TreeSet.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait SortedSet[A]trait SortedSet[A]class AbstractSet[A]trait Set[A]trait Shrinkable[A]trait Growable[A]trait Clearabletrait Cloneabletrait Iterable[A]class AbstractSet[A]trait Set[A]trait Equalsclass AbstractIterable[A]trait Iterable[A]trait IterableOnce[A]class Objecttrait Matchableclass AnyShow 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
- class
- Source
- TreeSet.scala
- Supertypes
-
trait SortedIterableFactory[TreeSet]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
TreeSet.type
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.
Attributes
- Companion
- object
- Source
- UnrolledBuffer.scala
- Supertypes
-
trait DefaultSerializabletrait Serializableclass AbstractBuffer[T]trait Buffer[T]trait Shrinkable[T]trait Growable[T]trait Clearableclass AbstractSeq[T]trait Seq[T]trait Cloneabletrait Iterable[T]class AbstractSeq[T]trait Seq[T]trait Equalsclass AbstractIterable[T]trait Iterable[T]trait IterableOnce[T]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Source
- UnrolledBuffer.scala
- Supertypes
-
trait ClassTagSeqFactory[UnrolledBuffer]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
UnrolledBuffer.type
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 parameters
- K
-
type of keys contained in this map
- V
-
type of values associated with the keys
Attributes
- See also
-
"Scala's Collection Library overview" section on
Weak Hash Maps
for more information. - Companion
- object
- Source
- WeakHashMap.scala
- Supertypes
-
class JMapWrapper[K, V]class AbstractJMapWrapper[K, V]trait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow 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
- class
- Source
- WeakHashMap.scala
- Supertypes
- Self type
-
WeakHashMap.type
Deprecated classlikes
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 parameters
- K
-
the type of the keys contained in this list map.
- V
-
the type of the values assigned to keys in this list map.
Attributes
- Companion
- object
- Deprecated
- true
- Source
- ListMap.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait Shrinkable[K]trait Clearabletrait Cloneabletrait Equalstrait K => Vclass Objecttrait Matchableclass AnyShow 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
- class
- Deprecated
- true
- Source
- ListMap.scala
- Supertypes
- Self type
-
ListMap.type
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.
Attributes
- 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
- true
- Source
- MultiMap.scala
- Supertypes
Attributes
- Companion
- class
- Deprecated
- true
- Source
- OpenHashMap.scala
- Supertypes
- Self type
-
OpenHashMap.type
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 parameters
- Key
-
type of the keys in this map.
- Value
-
type of the values in this map.
Value parameters
- initialSize
-
the initial size of the internal hash table.
Attributes
- Companion
- object
- Deprecated
- true
- Source
- OpenHashMap.scala
- Supertypes
-
trait DefaultSerializabletrait Serializabletrait Shrinkable[Key]trait Clearabletrait Cloneabletrait Equalstrait Key => Valueclass Objecttrait Matchableclass AnyShow all
Deprecated types
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Value members
Deprecated fields
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala
Attributes
- Deprecated
- true
- Source
- package.scala