randoop.util
Class MultiMap<T1,T2>

Object
  extended by MultiMap<T1,T2>
All Implemented Interfaces:
IMultiMap<T1,T2>

public class MultiMap<T1,T2>
extends Object
implements IMultiMap<T1,T2>

Implements an IMultiMap with a java.util.LinkedHashMap.


Constructor Summary
Constructor and Description
MultiMap()
           
MultiMap(int i)
           
 
Method Summary
Modifier and Type Method and Description
 void add(T1 key, T2 value)
          Precondition: the mapping key->value is not already in the map.
 void addAll(Map<? extends T1,? extends T2> m)
           
 void addAll(T1 key, Collection<? extends T2> values)
           
 void clear()
           
 boolean contains(T1 obj)
           
 Set<T2> getValues(T1 key)
          Returns the values that the given key maps to.
 boolean isEmpty()
           
 Set<T1> keySet()
          Returns the set of keys in this map (the domain).
 void put(T1 key, Collection<? extends T2> values)
           
 void remove(T1 key)
           
 void remove(T1 key, T2 value)
          Precondition: the mapping key->value is in the map.
 int size()
          Returns the size of this map: the number of mappings.
 String toString()
          Returns a String representation of this map.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiMap

public MultiMap()

MultiMap

public MultiMap(int i)
Method Detail

put

public void put(T1 key,
                Collection<? extends T2> values)

addAll

public void addAll(Map<? extends T1,? extends T2> m)

addAll

public void addAll(T1 key,
                   Collection<? extends T2> values)

add

public void add(T1 key,
                T2 value)
Description copied from interface: IMultiMap
Precondition: the mapping key->value is not already in the map.

Specified by:
add in interface IMultiMap<T1,T2>
Parameters:
key - cannot be null.
value - cannot be null.

remove

public void remove(T1 key,
                   T2 value)
Description copied from interface: IMultiMap
Precondition: the mapping key->value is in the map.

Specified by:
remove in interface IMultiMap<T1,T2>
Parameters:
key - cannot be null.
value - cannot be null.

remove

public void remove(T1 key)

getValues

public Set<T2> getValues(T1 key)
Description copied from interface: IMultiMap
Returns the values that the given key maps to.

Specified by:
getValues in interface IMultiMap<T1,T2>
Parameters:
key - cannot be null.

keySet

public Set<T1> keySet()
Description copied from interface: IMultiMap
Returns the set of keys in this map (the domain).

Specified by:
keySet in interface IMultiMap<T1,T2>

contains

public boolean contains(T1 obj)

clear

public void clear()

size

public int size()
Description copied from interface: IMultiMap
Returns the size of this map: the number of mappings.

Specified by:
size in interface IMultiMap<T1,T2>

isEmpty

public boolean isEmpty()

toString

public String toString()
Description copied from interface: IMultiMap
Returns a String representation of this map.

Specified by:
toString in interface IMultiMap<T1,T2>
Overrides:
toString in class Object