scala.collection.mutable

ConcurrentMap

trait ConcurrentMap[A, B] extends Map[A, B]

A template trait for mutable maps that allow concurrent access.

This is a base trait for all Scala concurrent map implementations. It provides all of the methods a Map does, with the difference that all the changes are atomic. It also describes methods specific to concurrent maps. Note: The concurrent maps do not accept null for keys or values.

A

the key type of the map

B

the value type of the map

known subclasses: JConcurrentMapWrapper
source: ConcurrentMap.scala
    since
  1. 2.8

Inherited
  1. Hide All
  2. Show all
  1. Map
  2. MapLike
  3. Cloneable
  4. Shrinkable
  5. Builder
  6. Growable
  7. Map
  8. MapLike
  9. Subtractable
  10. PartialFunction
  11. Function1
  12. Iterable
  13. Iterable
  14. IterableLike
  15. Equals
  16. Traversable
  17. Mutable
  18. Traversable
  19. GenericTraversableTemplate
  20. TraversableLike
  21. TraversableOnce
  22. FilterMonadic
  23. HasNewBuilder
  24. AnyRef
  25. Any
Visibility
  1. Public
  2. All

Type Members

  1. class DefaultKeySet extends Set[A]

    The implementation class of the set returned by keySet.

  2. class DefaultValuesIterable extends Iterable[B]

    The implementation class of the iterable returned by values.

  3. type Self = Map[A, B]

    The type implementing this traversable

  4. class WithFilter extends FilterMonadic[A, Repr]

    A class supporting filtered operations.

Value Members

  1. def !=(arg0: AnyRef): Boolean

  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

  3. def ##(): Int

  4. def $asInstanceOf[T0](): T0

  5. def $isInstanceOf[T0](): Boolean

  6. def +[B1 >: B](elem1: (A, B1), elem2: (A, B1), elems: (A, B1)*): Map[A, B1]

    Creates a new map containing two or more key/value mappings and all the key/value mappings of this map.

  7. def +[B1 >: B](kv: (A, B1)): Map[A, B1]

    Creates a new map containing a new key/value mapping and all the key/value mappings of this map.

  8. def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): Map[A, B1]

    Creates a new map containing the key/value mappings provided by the specified traversable object and all the key/value mappings of this map.

  9. def ++(that: TraversableOnce[(A, B)]): ConcurrentMap[(A, B)]

    [use case] Concatenates this concurrent map with the elements of a traversable collection.

  10. def ++[B >: (A, B), That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Concatenates this concurrent map with the elements of a traversable collection.

  11. def ++=(xs: TraversableOnce[(A, B)]): Growable[(A, B)]

    adds all elements produced by a TraversableOnce to this concurrent map.

  12. def +=(elem1: (A, B), elem2: (A, B), elems: (A, B)*): Growable[(A, B)]

    adds two or more elements to this concurrent map.

  13. def +=(kv: (A, B)): MapLike[A, B, Map[A, B]]

    Adds a new key/value pair to this map.

  14. def -(elem1: A, elem2: A, elems: A*): Map[A, B]

    Creates a new map with all the key/value mappings of this map except mappings with keys equal to any of the two or more specified keys.

  15. def -(key: A): Map[A, B]

    Creates a new map with all the key/value mappings of this map except the key/value mapping with the specified key.

  16. def --(xs: TraversableOnce[A]): Map[A, B]

    Creates a new map with all the key/value mappings of this map except mappings with keys equal to any of those provided by the specified traversable object.

  17. def --=(xs: TraversableOnce[A]): Shrinkable[A]

    Removes all elements produced by an iterator from this concurrent map.

  18. def -=(elem1: A, elem2: A, elems: A*): Shrinkable[A]

    Removes two or more elements from this concurrent map.

  19. def -=(key: A): MapLike[A, B, Map[A, B]]

    Removes a key from this map.

  20. def /:[B](z: B)(op: (B, (A, B)) ⇒ B): B

    Applies a binary operator to a start value and all elements of this concurrent map, going left to right.

  21. def :\[B](z: B)(op: ((A, B), B) ⇒ B): B

    Applies a binary operator to all elements of this concurrent map and a start value, going right to left.

  22. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

  23. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

  24. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Appends all bindings of this map to a string builder using start, end, and separator strings.

  25. def addString(b: StringBuilder): StringBuilder

    Appends all elements of this concurrent map to a string builder.

  26. def addString(b: StringBuilder, sep: String): StringBuilder

    Appends all elements of this concurrent map to a string builder using a separator string.

  27. def andThen[C](k: (B) ⇒ C): PartialFunction[A, C]

    Composes this partial function with a transformation function that gets applied to results of this partial function.

  28. def apply(key: A): B

    Retrieves the value which is associated with the given key.

  29. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

  30. def canEqual(that: Any): Boolean

    Method called from equality methods, so that user-defined subclasses can refuse to be equal to other collections of the same kind.

  31. def clear(): Unit

    Removes all bindings from the map.

  32. def clone(): Map[A, B]

    This method creates and returns a copy of the receiver object.

  33. def collect[B](pf: PartialFunction[(A, B), B]): ConcurrentMap[B]

    [use case] Builds a new collection by applying a partial function to all elements of this concurrent map on which the function is defined.

  34. def collect[B, That](pf: PartialFunction[(A, B), B])(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Builds a new collection by applying a partial function to all elements of this concurrent map on which the function is defined.

  35. def companion: GenericCompanion[Iterable[A][A]]

    The factory companion object that builds instances of class ConcurrentMap.

  36. def compose[A](g: (A) ⇒ A): (A) ⇒ B

    (f compose g)(x) == f(g(x))

  37. def contains(key: A): Boolean

    Tests whether this map contains a binding for a key.

  38. def copyToArray(xs: Array[(A, B)], start: Int, len: Int): Unit

    [use case] Copies elements of this concurrent map to an array.

  39. def copyToArray[B >: (A, B)](xs: Array[B], start: Int, len: Int): Unit

    Copies elements of this concurrent map to an array.

  40. def copyToArray(xs: Array[(A, B)]): Unit

    [use case] Copies values of this concurrent map to an array.

  41. def copyToArray[B >: (A, B)](xs: Array[B]): Unit

    Copies values of this concurrent map to an array.

  42. def copyToArray(xs: Array[(A, B)], start: Int): Unit

    [use case] Copies values of this concurrent map to an array.

  43. def copyToArray[B >: (A, B)](xs: Array[B], start: Int): Unit

    Copies values of this concurrent map to an array.

  44. def copyToBuffer[B >: (A, B)](dest: Buffer[B]): Unit

    Copies all elements of this concurrent map to a buffer.

  45. def count(p: ((A, B)) ⇒ Boolean): Int

    Counts the number of elements in the concurrent map which satisfy a predicate.

  46. def default(key: A): B

    Defines the default value computation for the map, returned when a key is not found The method implemented here throws an exception, but it might be overridden in subclasses.

  47. def drop(n: Int): Map[A, B]

    Selects all elements except first n ones.

  48. def dropRight(n: Int): Map[A, B]

    Selects all elements except last n ones.

  49. def dropWhile(p: ((A, B)) ⇒ Boolean): Map[A, B]

    Drops longest prefix of elements that satisfy a predicate.

  50. def elements: Iterator[(A, B)]

  51. def empty: Map[A, B]

    The empty map of the same type as this map

  52. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

  53. def equals(that: Any): Boolean

    Compares two maps structurally; i.

  54. def exists(p: ((A, B)) ⇒ Boolean): Boolean

    Tests whether a predicate holds for some of the elements of this concurrent map.

  55. def filter(p: ((A, B)) ⇒ Boolean): Map[A, B]

    Selects all elements of this concurrent map which satisfy a predicate.

  56. def filterKeys(p: (A) ⇒ Boolean): Map[A, B]

    Filters this map by retaining only keys satisfying a predicate.

  57. def filterNot(p: ((A, B)) ⇒ Boolean): Map[A, B]

    Returns a new map with all key/value pairs for which the predicate p returns true.

  58. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

  59. def find(p: ((A, B)) ⇒ Boolean): Option[(A, B)]

    Finds the first element of the concurrent map satisfying a predicate, if any.

  60. def first: (A, B)

  61. def firstOption: Option[(A, B)]

    None if iterable is empty.

  62. def flatMap[B](f: ((A, B)) ⇒ Traversable[B]): ConcurrentMap[B]

    [use case] Builds a new collection by applying a function to all elements of this concurrent map and concatenating the results.

  63. def flatMap[B, That](f: ((A, B)) ⇒ Traversable[B])(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Builds a new collection by applying a function to all elements of this concurrent map and concatenating the results.

  64. def flatten[B]: ConcurrentMap[B]

    [use case] Converts this concurrent map of traversable collections into a concurrent map in which all element collections are concatenated.

  65. def flatten[B](implicit asTraversable: ((A, B)) ⇒ Traversable[B]): Iterable[B]

    Converts this concurrent map of traversable collections into a concurrent map in which all element collections are concatenated.

  66. def foldLeft[B](z: B)(op: (B, (A, B)) ⇒ B): B

    Applies a binary operator to a start value and all elements of this concurrent map, going left to right.

  67. def foldRight[B](z: B)(op: ((A, B), B) ⇒ B): B

    Applies a binary operator to all elements of this concurrent map and a start value, going right to left.

  68. def forall(p: ((A, B)) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all elements of this concurrent map.

  69. def foreach(f: ((A, B)) ⇒ Unit): Unit

    [use case] Applies a function f to all elements of this concurrent map.

  70. def foreach[U](f: ((A, B)) ⇒ U): Unit

    Applies a function f to all elements of this concurrent map.

  71. def genericBuilder[B]: Builder[B, Iterable[B]]

    The generic builder that builds instances of ConcurrentMap at arbitrary element types.

  72. def get(key: A): Option[B]

    Optionally returns the value associated with a key.

  73. def getClass(): java.lang.Class[_ <: java.lang.Object]

    Returns a representation that corresponds to the dynamic class of the receiver object.

  74. def getOrElse(key: A, default: ⇒ B): B

    [use case] Returns the value associated with a key, or a default value if the key is not contained in the map.

  75. def getOrElse[B1 >: B](key: A, default: ⇒ B1): B1

    Returns the value associated with a key, or a default value if the key is not contained in the map.

  76. def getOrElseUpdate(key: A, op: ⇒ B): B

    If given key is already in this map, returns associated value.

  77. def groupBy[K](f: ((A, B)) ⇒ K): Map[K, Map[A, B]]

    Partitions this concurrent map into a map of concurrent maps according to some discriminator function.

  78. def grouped(size: Int): Iterator[Map[A, B]]

    Partitions elements in fixed size concurrent maps.

  79. def hasDefiniteSize: Boolean

    Tests whether this concurrent map is known to have a finite size.

  80. def hashCode(): Int

    Returns a hash code value for the object.

  81. def head: (A, B)

    Selects the first element of this concurrent map.

  82. def headOption: Option[(A, B)]

    Optionally selects the first element.

  83. def init: Map[A, B]

    Selects all elements except the last.

  84. def isDefinedAt(key: A): Boolean

    Tests whether this map contains a binding for a key.

  85. def isEmpty: Boolean

    Tests whether the map is empty.

  86. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

  87. def isTraversableAgain: Boolean

    Tests whether this concurrent map can be repeatedly traversed.

  88. def iterator: Iterator[(A, B)]

    Creates a new iterator over all key/value pairs of this map

  89. def keySet: Set[A]

    Collects all keys of this map in a set.

  90. def keys: Iterable[A]

    Creates an iterator for all keys.

  91. def keysIterator: Iterator[A]

    Creates an iterator for all keys.

  92. def last: (A, B)

    Selects the last element.

  93. def lastOption: Option[(A, B)]

    Optionally selects the last element.

  94. def lift: (A) ⇒ Option[B]

    Turns this partial function into an plain function returning an Option result.

  95. def map[B](f: ((A, B)) ⇒ B): ConcurrentMap[B]

    [use case] Builds a new collection by applying a function to all elements of this concurrent map.

  96. def map[B, That](f: ((A, B)) ⇒ B)(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Builds a new collection by applying a function to all elements of this concurrent map.

  97. def mapElements[C](f: (B) ⇒ C): Map[A, C]

  98. def mapResult[NewTo](f: (Map[A, B]) ⇒ NewTo): Builder[(A, B), NewTo]

    Creates a new builder by applying a transformation function to the results of this builder.

  99. def mapValues[C](f: (B) ⇒ C): Map[A, C]

    Transforms this map by applying a function to every retrieved value.

  100. def max: (A, B)

    [use case] Finds the largest element.

  101. def max[B >: (A, B)](implicit cmp: Ordering[B]): (A, B)

    Finds the largest element.

  102. def min: (A, B)

    [use case] Finds the smallest element.

  103. def min[B >: (A, B)](implicit cmp: Ordering[B]): (A, B)

    Finds the smallest element.

  104. def mkString: String

    Displays all elements of this concurrent map in a string.

  105. def mkString(sep: String): String

    Displays all elements of this concurrent map in a string using a separator string.

  106. def mkString(start: String, sep: String, end: String): String

    Displays all elements of this concurrent map in a string using start, end, and separator strings.

  107. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

  108. def newBuilder: Builder[(A, B), Map[A, B]]

    A common implementation of newBuilder for all mutable maps in terms of empty.

  109. def nonEmpty: Boolean

    Tests whether the concurrent map is not empty.

  110. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

  111. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

  112. def orElse[A1 <: A, B1 >: B](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]

    Composes this partial function with a fallback partial function which gets applied where this partial function is not defined.

  113. def partition(p: ((A, B)) ⇒ Boolean): (Map[A, B], Map[A, B])

    Partitions this concurrent map in two concurrent maps according to a predicate.

  114. def product: Int

    [use case] Multiplies up the elements of this collection.

  115. def product[B >: (A, B)](implicit num: Numeric[B]): B

    Multiplies up the elements of this collection.

  116. def projection: IterableView[(A, B), Map[A, B]]

    returns a projection that can be used to call non-strict filter,map, and flatMap methods that build projections of the collection.

  117. def put(key: A, value: B): Option[B]

    Adds a new key/value pair to this map and optionally returns previously bound value.

  118. def putIfAbsent(k: A, v: B): Option[B]

    Associates the given key with a given value, unless the key was already associated with some other value.

  119. def reduceLeft[B >: (A, B)](op: (B, (A, B)) ⇒ B): B

    Applies a binary operator to all elements of this concurrent map, going left to right.

  120. def reduceLeftOption[B >: (A, B)](op: (B, (A, B)) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this concurrent map, going left to right.

  121. def reduceRight[B >: (A, B)](op: ((A, B), B) ⇒ B): B

    Applies a binary operator to all elements of this concurrent map, going right to left.

  122. def reduceRightOption[B >: (A, B)](op: ((A, B), B) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this concurrent map, going right to left.

  123. def remove(key: A): Option[B]

    Removes a key from this map, returning the value associated previously with that key as an option.

  124. def remove(k: A, v: B): Boolean

    Removes the entry for the specified key if its currently mapped to the specified value.

  125. def removeKey(key: A): Option[B]

    If given key is defined in this map, remove it and return associated value as an Option.

  126. def replace(k: A, v: B): Option[B]

    Replaces the entry for the given key only if it was previously mapped to some value.

  127. def replace(k: A, oldvalue: B, newvalue: B): Boolean

    Replaces the entry for the given key only if it was previously mapped to a given value.

  128. def repr: Map[A, B]

    The collection of type concurrent map underlying this TraversableLike object.

  129. def result(): Map[A, B]

    The result when this map is used as a builder

  130. def retain(p: (A, B) ⇒ Boolean): MapLike[A, B, Map[A, B]]

    Retains only those mappings for which the predicate p returns true.

  131. def reversed: List[(A, B)]

  132. def sameElements(that: Iterable[(A, B)]): Boolean

    [use case] Checks if the other iterable collection contains the same elements in the same order as this concurrent map.

  133. def sameElements[B >: (A, B)](that: Iterable[B]): Boolean

    Checks if the other iterable collection contains the same elements in the same order as this concurrent map.

  134. def scanLeft[B, That](z: B)(op: (B, (A, B)) ⇒ B)(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Produces a collection containing cummulative results of applying the operator going left to right.

  135. def scanRight[B, That](z: B)(op: ((A, B), B) ⇒ B)(implicit bf: CanBuildFrom[Map[A, B], B, That]): That

    Produces a collection containing cummulative results of applying the operator going right to left.

  136. def size: Int

    The size of this concurrent map.

  137. def sizeHint(coll: scala.collection.TraversableLike[_, _], delta: Int = 0): Unit

    Gives a hint that one expects the result of this builder to have the same size as the given collection, plus some delta.

  138. def sizeHint(size: Int): Unit

    Gives a hint how many elements are expected to be added when the next result is called.

  139. def sizeHintBounded(size: Int, boundingColl: scala.collection.TraversableLike[_, _]): Unit

    Gives a hint how many elements are expected to be added when the next result is called, together with an upper bound given by the size of some other collection.

  140. def slice(from: Int, until: Int): Map[A, B]

    Selects an interval of elements.

  141. def sliding[B >: (A, B)](size: Int, step: Int): Iterator[Map[A, B]]

  142. def sliding[B >: (A, B)](size: Int): Iterator[Map[A, B]]

    Groups elements in fixed size blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped.

  143. def span(p: ((A, B)) ⇒ Boolean): (Map[A, B], Map[A, B])

    Splits this concurrent map into a prefix/suffix pair according to a predicate.

  144. def splitAt(n: Int): (Map[A, B], Map[A, B])

    Splits this concurrent map into two at a given position.

  145. def stringPrefix: String

    Defines the prefix of this object's toString representation.

  146. def sum: Int

    [use case] Sums up the elements of this collection.

  147. def sum[B >: (A, B)](implicit num: Numeric[B]): B

    Sums up the elements of this collection.

  148. def synchronized[T0](arg0: T0): T0

  149. def tail: Map[A, B]

    Selects all elements except the first.

  150. def take(n: Int): Map[A, B]

    Selects first n elements.

  151. def takeRight(n: Int): Map[A, B]

    Selects last n elements.

  152. def takeWhile(p: ((A, B)) ⇒ Boolean): Map[A, B]

    Takes longest prefix of elements that satisfy a predicate.

  153. def thisCollection: Iterable[(A, B)]

    The underlying collection seen as an instance of ConcurrentMap.

  154. def toArray: Array[(A, B)]

    [use case] Converts this concurrent map to an array.

  155. def toArray[B >: (A, B)](implicit arg0: ClassManifest[B]): Array[B]

    Converts this concurrent map to an array.

  156. def toBuffer[B >: (A, B)]: Buffer[B]

    Converts this concurrent map to a mutable buffer.

  157. def toCollection(repr: Map[A, B]): Iterable[(A, B)]

    A conversion from collections of type Repr to ConcurrentMap objects.

  158. def toIndexedSeq[B >: (A, B)]: IndexedSeq[B]

    Converts this concurrent map to an indexed sequence.

  159. def toIterable: Iterable[(A, B)]

    Converts this concurrent map to an iterable collection.

  160. def toIterator: Iterator[(A, B)]

    Returns an Iterator over the elements in this concurrent map.

  161. def toList: List[(A, B)]

    Converts this concurrent map to a list.

  162. def toMap[T, U](implicit ev: <:<[(A, B), (T, U)]): Map[T, U]

    Converts this concurrent map to a map.

  163. def toSeq: Seq[(A, B)]

    Converts this concurrent map to a sequence.

  164. def toSet[B >: (A, B)]: Set[B]

    Converts this concurrent map to a set.

  165. def toStream: Stream[(A, B)]

    Converts this concurrent map to a stream.

  166. def toString(): String

    Converts this concurrent map to a string.

  167. def toTraversable: Traversable[(A, B)]

    Converts this concurrent map to an unspecified Traversable.

  168. def transform(f: (A, B) ⇒ B): MapLike[A, B, Map[A, B]]

    Applies a transformation function to all values contained in this map.

  169. def transpose[B](implicit asTraversable: ((A, B)) ⇒ Traversable[B]): Iterable[Iterable[B]]

    Transposes this concurrent map of traversable collections into a concurrent map of concurrent maps.

  170. def unzip[A1, A2](implicit asPair: ((A, B)) ⇒ (A1, A2)): (Iterable[A1], Iterable[A2])

    Converts this concurrent map of pairs into two collections of the first and second halfs of each pair.

  171. def update(key: A, value: B): Unit

    Adds a new key/value pair to this map.

  172. def updated[B1 >: B](key: A, value: B1): Map[A, B1]

    Creates a new map consisting of all key/value pairs of the current map plus a new pair of a given key and value.

  173. def values: Iterable[B]

    Collects all values of this map in an iterable collection.

  174. def valuesIterator: Iterator[B]

    Creates an iterator for all values in this map.

  175. def view(from: Int, until: Int): IterableView[(A, B), Map[A, B]]

    Creates a non-strict view of a slice of this concurrent map.

  176. def view: IterableView[(A, B), Map[A, B]]

    Creates a non-strict view of this concurrent map.

  177. def wait(): Unit

  178. def wait(arg0: Long, arg1: Int): Unit

  179. def wait(arg0: Long): Unit

  180. def withFilter(p: ((A, B)) ⇒ Boolean): FilterMonadic[(A, B), Map[A, B]]

    Creates a non-strict filter of this concurrent map.

  181. def zip[B](that: Iterable[B]): ConcurrentMap[((A, B), B)]

    [use case] Returns a concurrent map formed from this concurrent map and another iterable collection by combining corresponding elements in pairs.

  182. def zip[A1 >: (A, B), B, That](that: Iterable[B])(implicit bf: CanBuildFrom[Map[A, B], (A1, B), That]): That

    Returns a concurrent map formed from this concurrent map and another iterable collection by combining corresponding elements in pairs.

  183. def zipAll[B](that: Iterable[B], thisElem: (A, B), thatElem: B): ConcurrentMap[((A, B), B)]

    [use case] Returns a concurrent map formed from this concurrent map and another iterable collection by combining corresponding elements in pairs.

  184. def zipAll[B, A1 >: (A, B), That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Map[A, B], (A1, B), That]): That

    Returns a concurrent map formed from this concurrent map and another iterable collection by combining corresponding elements in pairs.

  185. def zipWithIndex: ConcurrentMap[((A, B), Int)]

    [use case] Zips this concurrent map with its indices.

  186. def zipWithIndex[A1 >: (A, B), That](implicit bf: CanBuildFrom[Map[A, B], (A1, Int), That]): That

    Zips this concurrent map with its indices.