public class TypedMultiMap<T,K>
extends java.lang.Object
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
.
Modifier and Type | Method and Description |
---|---|
static <T,K> TypedMultiMap<T,K> |
empty()
Obtain the empty map for the given key type and key–value type function.
|
boolean |
equals(java.lang.Object other) |
scala.collection.immutable.Set<K> |
get(T key)
Obtain all mappings for the given key.
|
int |
hashCode() |
TypedMultiMap<T,K> |
inserted(T key,
K value)
Return a map that has the given value added to the mappings for the given key.
|
TypedMultiMap<T,K> |
keyRemoved(T key)
Return a map that has all mappings for the given key removed.
|
scala.collection.immutable.Set<T> |
keySet()
Return the set of keys which are mapped to non-empty value sets.
|
TypedMultiMap<T,K> |
removed(T key,
K value)
Return a map that has the given mapping from the given key removed.
|
java.lang.String |
toString() |
TypedMultiMap<T,K> |
valueRemoved(java.lang.Object value)
Return a map that has the given value removed from all keys.
|
public static <T,K> TypedMultiMap<T,K> empty()
public scala.collection.immutable.Set<T> keySet()
public TypedMultiMap<T,K> inserted(T key, K value)
key
- (undocumented)value
- (undocumented)public scala.collection.immutable.Set<K> get(T key)
key
- (undocumented)public TypedMultiMap<T,K> valueRemoved(java.lang.Object value)
value
- (undocumented)public TypedMultiMap<T,K> keyRemoved(T key)
key
- (undocumented)public TypedMultiMap<T,K> removed(T key, K value)
key
- (undocumented)value
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object