K
- The Class of the key for this MapToListV
- The Class of the Value for this MapToListpublic interface MapToList<K,V>
Modifier and Type | Method and Description |
---|---|
void |
addAllLists(MapToList<K,V> mtl)
Adds all of the Lists in the given MapToList to this MapToList.
|
void |
addAllToListFor(K key,
java.util.Collection<? extends V> valueCollection)
Adds all of the Objects in the given list to the (internal) List for the
given key.
|
void |
addToListFor(K key,
V value)
Adds the given value to the List for the given key.
|
void |
clear()
Clears this MapToList (removes all keys/list combinations).
|
boolean |
containsInList(K key,
V value)
Returns true if this MapToList contains a List for the given key and that
list contains the given value.
|
boolean |
containsListFor(K key)
Returns true if this MapToList contains a List for the given key.
|
V |
getElementInList(K key,
int index)
Returns a specific element in the list for the given key.
|
java.util.Set<K> |
getKeySet()
Returns a Set indicating the Keys of this MapToList.
|
java.util.List<V> |
getListFor(K key)
Returns a copy of the List contained in this MapToList for the given key.
|
boolean |
isEmpty()
Returns true if this MapToList contains no Lists.
|
boolean |
removeFromListFor(K key,
V value)
Removes the given value from the list for the given key.
|
java.util.List<V> |
removeListFor(K key)
Removes the List for the given key.
|
int |
size()
Returns the number of lists contained by this MapToList.
|
int |
sizeOfListFor(K key)
Returns the number of objects in the List for the given key.
|
void addToListFor(K key, V value)
key
- The key indicating which List the given object should be added
to.value
- The value to be added to the List for the given key.void addAllToListFor(K key, java.util.Collection<? extends V> valueCollection)
key
- The key indicating which List the objects in the given List
should be added to.valueCollection
- A Collection containing the items to be added to the List for
the given key.java.lang.NullPointerException
- if the given Collection is nullvoid addAllLists(MapToList<K,V> mtl)
mtl
- The MapToList from which all of the Lists should be importedjava.lang.NullPointerException
- if the given MapToList is nullboolean containsListFor(K key)
key
- The key being tested.boolean containsInList(K key, V value)
key
- The key for the List being tested.value
- The value to find in the List for the given key.int sizeOfListFor(K key)
key
- The key being tested.java.util.List<V> getListFor(K key)
key
- The key for which a copy of the list should be returned.boolean removeFromListFor(K key, V value)
key
- The key indicating which List the given object should be
removed fromvalue
- The value to be removed from the List for the given keyjava.util.List<V> removeListFor(K key)
key
- The key indicating which List the given object should be
removed fromboolean isEmpty()
int size()
java.util.Set<K> getKeySet()
V getElementInList(K key, int index)
key
- The key used to identify the list from which the specified
value will be returnedindex
- The location in the list (for the given key) of the value to
be returnedjava.lang.IllegalArgumentException
- if the given key does not exist in this MapToListjava.lang.IndexOutOfBoundsException
- if the index is out of range for the list for the given key
(index is less than zero OR greater than or equal to the size
of the list)void clear()