K
- the key typeV
- the value typepublic abstract class AbstractMultimap<K,V> extends Object implements Multimap<K,V>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMultimap.EntriesCollection |
protected class |
AbstractMultimap.EntryIterator |
protected class |
AbstractMultimap.ValueIterator |
protected class |
AbstractMultimap.ValuesCollection |
protected class |
AbstractMultimap.WrappedCollection |
protected class |
AbstractMultimap.WrappedKeySet |
protected class |
AbstractMultimap.WrappedList |
protected class |
AbstractMultimap.WrappedMap |
protected class |
AbstractMultimap.WrappedSortedKeySet |
Modifier | Constructor and Description |
---|---|
protected |
AbstractMultimap(Map<K,Collection<V>> entries) |
Modifier and Type | Method and Description |
---|---|
Map<K,Collection<V>> |
asMap()
Return a map view that associates each key with the corresponding values in the multimap.
|
void |
clear()
Remove all key-value pairs from this multimap.
|
boolean |
containsEntry(Object key,
Object value)
Determine whether this multimap contains the supplied key-value pair.
|
boolean |
containsKey(K key)
Determine whether this multimap associates any values with the supplied key.
|
boolean |
containsValue(Object value)
Determine whether this multimap associates at least one key with the supplied value.
|
protected abstract Collection<V> |
createCollection() |
protected Iterator<Map.Entry<K,V>> |
createEntryIterator()
Return an iterator over all entries in this multimap.
|
protected Collection<V> |
createUnmodifiable(Collection<V> original) |
protected abstract Collection<V> |
createUnmodifiableEmptyCollection() |
Collection<Map.Entry<K,V>> |
entries()
Return a collection of all key-value pairs.
|
boolean |
equals(Object obj) |
Collection<V> |
get(K key)
Get the collection of values that are associated with the supplied key.
|
protected Collection<V> |
getOrCreateCollection(K key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet()
Return the set of keys in this multimap.
|
boolean |
put(K key,
V value)
Associate the supplied value with the given key, returning true if the size of this multimap was increased.
|
protected Map<K,Collection<V>> |
rawData() |
boolean |
remove(K key,
V value)
Remove the supplied key-value pair from this multi-map.
|
Collection<V> |
removeAll(K key)
Remove all of the key-value pairs that use the supplied key, returning the collection of values.
|
protected boolean |
removeAllValuesForKey(Object key) |
int |
size()
Return the number of key-value pairs in this multimap.
|
String |
toString() |
Collection<V> |
values()
Return a collection of all values in this multimap.
|
protected Collection<V> |
wrapCollection(K key,
Collection<V> values) |
protected Set<K> |
wrapKeySet() |
protected List<V> |
wrapList(K key,
List<V> values) |
protected Map<K,Collection<V>> |
wrapMap(Map<K,Collection<V>> map) |
protected AbstractMultimap(Map<K,Collection<V>> entries)
protected Map<K,Collection<V>> rawData()
protected abstract Collection<V> createCollection()
protected abstract Collection<V> createUnmodifiableEmptyCollection()
protected Collection<V> createUnmodifiable(Collection<V> original)
public int size()
Multimap
public boolean containsKey(K key)
Multimap
containsKey
in interface Multimap<K,V>
key
- the keytrue
if there is at least one value associated with the supplied key, or false
otherwisepublic boolean containsValue(Object value)
Multimap
containsValue
in interface Multimap<K,V>
value
- the valuetrue
if there is at least one key associated with the supplied value, or false
otherwisepublic boolean containsEntry(Object key, Object value)
Multimap
containsEntry
in interface Multimap<K,V>
key
- the keyvalue
- the valuetrue
if this multimap contains an entry with the supplied key and value, or false
otherwisepublic Collection<V> get(K key)
Multimap
Changes to the returned collection will update the values that this multimap associates with the key.
public boolean put(K key, V value)
Multimap
Some implementations allow duplicate key-value pairs, and in these cases this method will always increase the size of the multimap and will thus always return true. Other implementations will not allow duplicate key-value pairs, and may return false if the multimap already contains the supplied key-value pair.
protected Collection<V> getOrCreateCollection(K key)
public boolean remove(K key, V value)
Multimap
public Collection<V> removeAll(K key)
Multimap
protected boolean removeAllValuesForKey(Object key)
public Set<K> keySet()
Multimap
public void clear()
Multimap
public Map<K,Collection<V>> asMap()
Multimap
setValue()
on its entries,
put
, or putAll
.
The collections returned by asMap().get(Object)
have the same behavior as those returned by Multimap.get(K)
.
protected Iterator<Map.Entry<K,V>> createEntryIterator()
protected Collection<V> wrapCollection(K key, Collection<V> values)
protected Map<K,Collection<V>> wrapMap(Map<K,Collection<V>> map)
public Collection<V> values()
Multimap
public Collection<Map.Entry<K,V>> entries()
Multimap
add
or addAll
operations.Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.