class TypedMultiMap[T <: AnyRef, K[_ <: T]] extends AnyRef
An immutable multi-map that expresses the value type as a type function of the key type. Create it with a type constructor that expresses the relationship:
trait Key { type Type = T } case class MyValue[T](...) // type function from Key to MyValue type KV[K <: Key] = MyValue[K#Type] val map = TypedMultiMap.empty[Key, KV] // a plain Int => String map would use this function: type plain[K <: Int] = String // a map T => T would use this function: type identity[T <: AnyRef] = T
Caveat: using keys which take type parameters does not work due to conflicts
with the existential interpretation of Key[_]
. A workaround is to define
a key type like above and provide a subtype that provides its type parameter
as type member Type
.
- Source
- TypedMultiMap.scala
- Alphabetic
- By Inheritance
- TypedMultiMap
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toany2stringadd[TypedMultiMap[T, K]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ++(other: TypedMultiMap[T, K]): TypedMultiMap[T, K]
Add all entries from the other map, overwriting existing entries.
Add all entries from the other map, overwriting existing entries.
FIXME: should it merge, instead?
- def ->[B](y: B): (TypedMultiMap[T, K], B)
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toArrowAssoc[TypedMultiMap[T, K]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def ensuring(cond: (TypedMultiMap[T, K]) => Boolean, msg: => Any): TypedMultiMap[T, K]
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toEnsuring[TypedMultiMap[T, K]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (TypedMultiMap[T, K]) => Boolean): TypedMultiMap[T, K]
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toEnsuring[TypedMultiMap[T, K]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): TypedMultiMap[T, K]
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toEnsuring[TypedMultiMap[T, K]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): TypedMultiMap[T, K]
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toEnsuring[TypedMultiMap[T, K]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
- Definition Classes
- TypedMultiMap → AnyRef → Any
- def get(key: T): Set[K[key.type]]
Obtain all mappings for the given key.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- TypedMultiMap → AnyRef → Any
- def inserted(key: T)(value: K[key.type]): TypedMultiMap[T, K]
Return a map that has the given value added to the mappings for the given key.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def keyRemoved(key: T): TypedMultiMap[T, K]
Return a map that has all mappings for the given key removed.
- def keySet: Set[T]
Return the set of keys which are mapped to non-empty value sets.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def removed(key: T)(value: K[key.type]): TypedMultiMap[T, K]
Return a map that has the given mapping from the given key removed.
- def setAll(key: T)(values: Set[K[key.type]]): TypedMultiMap[T, K]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- TypedMultiMap → AnyRef → Any
- def valueRemoved(value: Any): TypedMultiMap[T, K]
Return a map that has the given value removed from all keys.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toStringFormat[TypedMultiMap[T, K]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (TypedMultiMap[T, K], B)
- Implicit
- This member is added by an implicit conversion from TypedMultiMap[T, K] toArrowAssoc[TypedMultiMap[T, K]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.