Key - key typeValue - value typepublic class MultiMap<Key,Value> extends Object implements Serializable
| Constructor and Description |
|---|
MultiMap()
default constructor
|
MultiMap(boolean threadsafe) |
MultiMap(boolean threadsafe,
boolean usesets) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clear map
|
boolean |
contains(Key k,
Value v) |
boolean |
containsKey(Key k) |
boolean |
containsValue(Value v) |
protected Collection<Value> |
createCollection() |
Collection<Value> |
get(Key key)
returns a mutable set of values connected to the key; if no value is
connected, returns an immutable empty set.
|
Set<Value> |
getAllValues() |
boolean |
isValueSetsEqual() |
Set<Key> |
keySet() |
boolean |
put(Key key,
Value value) |
void |
putAll(Key k,
Collection<Value> v) |
void |
putAll(MultiMap<Key,Value> otherMap)
add all entries from other map.
|
boolean |
remove(Key key)
removes the set of values connected to the key.
|
boolean |
remove(Key key,
Value value)
removes the value connected to the key; if there is more than one value
connected to the key, only one is removed.
|
void |
setEntry(Key key,
Collection<Value> values)
set an entry to a set of values
|
int |
size() |
String |
toString() |
public MultiMap()
public MultiMap(boolean threadsafe)
threadsafe - true if threadsafe collections should be usedpublic MultiMap(boolean threadsafe,
boolean usesets)
threadsafe - true if threadsafe collections should be usedusesets - true if sets should be usedpublic boolean put(Key key, Value value)
key - keyvalue - valueprotected Collection<Value> createCollection()
public void setEntry(Key key, Collection<Value> values)
key - keyvalues - valuespublic Collection<Value> get(Key key)
key - keypublic boolean remove(Key key)
key - keypublic boolean remove(Key key, Value value)
key - keyvalue - valuepublic int size()
public boolean contains(Key k, Value v)
k - keyv - valuepublic boolean containsKey(Key k)
k - the keypublic boolean containsValue(Value v)
v - valuepublic void clear()
public void putAll(MultiMap<Key,Value> otherMap)
otherMap - map to addpublic void putAll(Key k, Collection<Value> v)
k - keyv - all entries to addpublic boolean isValueSetsEqual()
Copyright © 2014 The University of Manchester. All Rights Reserved.