|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.plt.collect.ExternallySortedMultiMap<K,V,C>
public class ExternallySortedMultiMap<K,V,C extends Comparable<? super C>>
Maps from a key to a set of values; a key may be added multiple times
with different values, and those values are collected in a set.
Each set is ordered according to some Comparable corresponding to each
value. The methods provided are modeled after the Map
interface.
However, the container being modeled is not exactly a map, and some
of the Map methods do not make sense in this context. For example,
put(key, value)
was replaced here by put(key, value, orderBy)
.
Constructor Summary | |
---|---|
ExternallySortedMultiMap()
Create an empty map. |
Method Summary | |
---|---|
void |
clear()
Removes all elements from the map. |
boolean |
contains(K key,
V value)
|
boolean |
containsKey(K key)
|
boolean |
containsValue(V value)
|
Iterable<V> |
get(K key)
|
boolean |
isEmpty()
|
Iterable<K> |
keys()
|
boolean |
put(K key,
V value,
C orderBy)
Adds the (key, value) pair if it is not already present. |
boolean |
putAll(ExternallySortedMultiMap<? extends K,? extends V,? extends C> map)
Adds all (key, value) pairs represented by map to this map. |
boolean |
remove(K key,
V value)
Removes the (key, value) pair if it is present. |
boolean |
removeKey(K key)
Removes all values associated with the specified key. |
int |
size()
|
int |
size(int bound)
|
Iterable<V> |
values()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExternallySortedMultiMap()
Method Detail |
---|
public int size()
public int size(int bound)
bound
if it is less.public boolean isEmpty()
true
iff size() == 0
.public boolean containsKey(K key)
true
iff the specified key is mapped to at least 1 value.public boolean containsValue(V value)
true
iff the specified value is associated with some key.public boolean contains(K key, V value)
true
iff the specified (key, value) pair is in the map.public Iterable<V> get(K key)
orderBy
values. If the key maps to no values when
Iterable.iterator()
is invoked, a 0-length iterator is returned.
Iterator.remove()
is not supported.public boolean put(K key, V value, C orderBy)
true
iff the (key, value) pair is not already present in the map.public boolean remove(K key, V value)
true
iff the (key, value) pair was present in (and thus removed from)
the map.public boolean removeKey(K key)
true
iff the operation modifies the map.public boolean putAll(ExternallySortedMultiMap<? extends K,? extends V,? extends C> map)
map
to this map. If a mapping is already
present, adding it makes no modifications; otherwise, the pair is added, sorted according
to the orderBy
value in map
.
true
iff the operation modified the map.public void clear()
public Iterable<K> keys()
Iterator.remove()
is not supported.public Iterable<V> values()
Iterator.remove()
is not supported.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |