scala.collection.mutable

MultiMap

trait MultiMap[A, B] extends Map[A, Set[B]]

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 multi maps which map A to B objects.

source: MultiMap.scala
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. HasNewBuilder
  23. AnyRef
  24. 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, Set[B]]

    The type implementing this traversable

  4. class WithFilter extends AnyRef

    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 >: Set[B]](elem1: (A, B1), elem2: (A, B1), elems: (A, B1)*): Map[A, B1]

    Adds two or more key/value mappings and return the map itself .

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

    Add a new key/value mapping and return the map itself .

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

    Adds a number of elements provided by a traversable object via its iterator method and returns either the collection itself (if it is mutable), or a new collection with the added elements.

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

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

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

    Concatenates this multimap with the elements of a traversable collection .

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

    adds all elements produced by a TraversableOnce to this multimap .

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

    adds two or more elements to this multimap .

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

    Adds a new key/value pair to this map .

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

    Removes two or more elements from this collection and returns the collection itself .

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

    Delete a key from this map if it is present and return the map itself .

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

    Removes a number of elements provided by a Traversable object and returns the collection itself .

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

    Removes all elements produced by an iterator from this multimap .

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

    Removes two or more elements from this multimap .

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

    Removes a key from this map .

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

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

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

    Applies a binary operator to all elements of this multimap 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 add(key: A, value: B): MultiMap[A, B]

  25. def addBinding(key: A, value: B): MultiMap[A, B]

    Assigns the specified value to a specified key, replacing the existing value assigned to that key if it is equal to the specified value.

  26. 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 .

  27. def addString(b: StringBuilder): StringBuilder

    Appends all elements of this multimap to a string builder .

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

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

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

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

  30. def apply(key: A): Set[B]

    Retrieves the value which is associated with the given key .

  31. def asInstanceOf[T0]: T0

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

  32. 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 .

  33. def clear(): Unit

    Removes all bindings from the map .

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

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

  35. def collect[B](pf: PartialFunction[(A, Set[B]), B]): MultiMap[B]

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

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

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

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

    The factory companion object that builds instances of class MultiMap

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

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

  39. def contains(key: A): Boolean

    Tests whether this map contains a binding for a key .

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

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

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

    Copies elements of this multimap to an array .

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

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

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

    Copies values of this multimap to an array .

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

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

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

    Copies values of this multimap to an array .

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

    Copies all elements of this multimap to a buffer .

  47. def count(p: ((A, Set[B])) ⇒ Boolean): Int

    Counts the number of elements in the multimap which satisfy a predicate .

  48. def default(key: A): Set[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 .

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

    Selects all elements except first n ones.

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

    Selects all elements except last n ones.

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

    Drops longest prefix of elements that satisfy a predicate .

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

  53. def empty: Map[A, Set[B]]

    The empty map of the same type as this map

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

    Checks if there exists a binding to key such that it satisfies the predicate p.

  55. def eq(arg0: AnyRef): Boolean

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

  56. def equals(that: Any): Boolean

    Compares two maps structurally; i .

  57. def exists(p: ((A, Set[B])) ⇒ Boolean): Boolean

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

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

    Selects all elements of this multimap which satisfy a predicate .

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

    Filters this map by retaining only keys satisfying a predicate .

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

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

  61. 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 .

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

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

  63. def first: (A, Set[B])

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

    None if iterable is empty.

  65. def flatMap[B](f: ((A, Set[B])) ⇒ Traversable[B]): MultiMap[B]

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

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

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

  67. def flatten[B]: MultiMap[B]

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

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

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

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

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

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

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

  71. def forall(p: ((A, Set[B])) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all elements of this multimap .

  72. def foreach(f: ((A, Set[B])) ⇒ Unit): Unit

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

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

    Applies a function f to all elements of this multimap.

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

    The generic builder that builds instances of MultiMap

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

    Optionally returns the value associated with a key .

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

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

  77. def getOrElse(key: A, default: ⇒ Set[B]): Set[B]

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

  78. def getOrElse[B1 >: Set[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 .

  79. def getOrElseUpdate(key: A, op: ⇒ Set[B]): Set[B]

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

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

    Partitions this multimap into a map of multimaps according to some discriminator function .

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

    Partitions elements in fixed size multimaps .

  82. def hasDefiniteSize: Boolean

    Tests whether this multimap is known to have a finite size .

  83. def hashCode(): Int

    Returns a hash code value for the object .

  84. def head: (A, Set[B])

    Selects the first element of this multimap .

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

    Optionally selects the first element .

  86. def init: Map[A, Set[B]]

    Selects all elements except the last .

  87. def isDefinedAt(key: A): Boolean

    Tests whether this map contains a binding for a key .

  88. def isEmpty: Boolean

    Tests whether the map is empty .

  89. def isInstanceOf[T0]: Boolean

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

  90. def isTraversableAgain: Boolean

    Tests whether this multimap can be repeatedly traversed .

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

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

  92. def keySet: Set[A]

    Collects all keys of this map in a set .

  93. def keys: Iterable[A]

    Creates an iterator for all keys .

  94. def keysIterator: Iterator[A]

    Creates an iterator for all keys .

  95. def last: (A, Set[B])

    Selects the last element .

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

    Optionally selects the last element .

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

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

  98. def makeSet: Set[B]

    Creates a new set .

  99. def map[B](f: ((A, Set[B])) ⇒ B): MultiMap[B]

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

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

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

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

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

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

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

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

  104. def max: (A, Set[B])

    [use case] Finds the largest element .

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

    Finds the largest element .

  106. def min: (A, Set[B])

    [use case] Finds the smallest element .

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

    Finds the smallest element .

  108. def mkString: String

    Displays all elements of this multimap in a string .

  109. def mkString(sep: String): String

    Displays all elements of this multimap in a string using a separator string .

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

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

  111. def ne(arg0: AnyRef): Boolean

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

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

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

  113. def nonEmpty: Boolean

    Tests whether the multimap is not empty .

  114. def notify(): Unit

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

  115. def notifyAll(): Unit

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

  116. def orElse[A1 <: A, B1 >: Set[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 .

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

    Partitions this multimap in two multimaps according to a predicate .

  118. def product: Int

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

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

    Multiplies up the elements of this collection .

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  127. def removeBinding(key: A, value: B): MultiMap[A, B]

    Removes the binding of value to key if it exists.

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

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

  129. def repr: Map[A, Set[B]]

    The collection of type multimap underlying this TraversableLike object.

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

    The result when this map is used as a builder

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

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

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

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

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

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

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

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

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

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

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

  137. def size: Int

    The size of this multimap .

  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 slice(from: Int, until: Int): Map[A, Set[B]]

    Selects an interval of elements .

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

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

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

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

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

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

    Splits this multimap into two at a given position .

  144. def stringPrefix: String

    Defines the prefix of this object's toString representation.

  145. def sum: Int

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

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

    Sums up the elements of this collection .

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

  148. def tail: Map[A, Set[B]]

    Selects all elements except the first .

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

    Selects first n elements.

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

    Selects last n elements.

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

    Takes longest prefix of elements that satisfy a predicate .

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

    The underlying collection seen as an instance of MultiMap

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

    [use case] Converts this multimap to an array .

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

    Converts this multimap to an array .

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

    A conversion from collections of type Repr to MultiMap

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

    Converts this multimap to an indexed sequence .

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

    Converts this multimap to an iterable collection .

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

    Returns an Iterator over the elements in this multimap .

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

    Converts this multimap to a list .

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

    Converts this multimap to a map .

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

    Converts this multimap to a sequence .

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

    Converts this multimap to a set .

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

    Converts this multimap to a stream .

  164. def toString(): String

    Converts this multimap to a string .

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

    Converts this multimap to an unspecified Traversable .

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

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

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

    Transposes this multimap of traversable collections into a multimap of multimaps .

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

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

  169. def update(key: A, value: Set[B]): Unit

    Adds a new key/value pair to this map .

  170. def updated[B1 >: Set[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 .

  171. def values: Iterable[Set[B]]

    Collects all values of this map in an iterable collection .

  172. def valuesIterator: Iterator[Set[B]]

    Creates an iterator for all values in this map .

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

    Creates a non-strict view of a slice of this multimap .

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

    Creates a non-strict view of this multimap .

  175. def wait(): Unit

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

  177. def wait(arg0: Long): Unit

  178. def withFilter(p: ((A, Set[B])) ⇒ Boolean): WithFilter

    Creates a non-strict filter of this multimap .

  179. def zip[B](that: Iterable[B]): MultiMap[((A, Set[B]), B)]

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

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

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

  181. def zipAll[B](that: Iterable[B], thisElem: (A, Set[B]), thatElem: B): MultiMap[((A, Set[B]), B)]

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

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

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

  183. def zipWithIndex: MultiMap[((A, Set[B]), Int)]

    [use case] Zips this multimap with its indices .

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

    Zips this multimap with its indices .