Package randoop.util
Class MultiMap<K,V>
java.lang.Object
randoop.util.MultiMap<K,V>
- All Implemented Interfaces:
IMultiMap<K,
V>
- Direct Known Subclasses:
MultiMap.EmptyMultiMap
Implements an IMultiMap with a java.util.LinkedHashMap.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
An immutable, empty multimap. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Precondition: the mapping key→value is not already in the map.void
void
addAll
(K key, Collection<? extends V> values) void
void
clear()
boolean
static <K,
V> MultiMap<K, V> empty()
Returns an immutable, empty multimap.Returns the values that the given key maps to.boolean
isEmpty()
keySet()
Returns the set of keys in this map (the domain).void
put
(K key, Collection<? extends V> values) Adds a key-values mapping to this multimapboolean
boolean
Precondition: the mapping key→value is in the map.int
size()
Returns the size of this map: the number of mappings.toString()
Returns a String representation of this map.
-
Field Details
-
map
-
-
Constructor Details
-
MultiMap
public MultiMap() -
MultiMap
public MultiMap(int initialCapacity)
-
-
Method Details
-
empty
Returns an immutable, empty multimap.- Returns:
- an immutable, empty multimap
-
put
Adds a key-values mapping to this multimap- Parameters:
key
- the keyvalues
- the values
-
addAll
-
addAll
-
addAll
-
add
Description copied from interface:IMultiMap
Precondition: the mapping key→value is not already in the map. -
remove
Description copied from interface:IMultiMap
Precondition: the mapping key→value is in the map. -
remove
-
getValues
Description copied from interface:IMultiMap
Returns the values that the given key maps to. -
keySet
Description copied from interface:IMultiMap
Returns the set of keys in this map (the domain). -
contains
-
clear
public void clear() -
size
public int size()Description copied from interface:IMultiMap
Returns the size of this map: the number of mappings. -
isEmpty
public boolean isEmpty() -
toString
Description copied from interface:IMultiMap
Returns a String representation of this map.
-