java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.collect.SetMap<K, V> |
A map of keys to sets. Keys may be ordered (none, natural, by insertion); the ordering for the
value sets may be specified as well. This class is serialializable
. Null key is
allowed; null values are allowed.
Thread-safety: none.
Note: this class does not implement the Map interface, but attempts to follow its guidelines and contracts the best it can. One notable exception is that this class does not override hashCode/equals.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SetMap()
Create a new set-map without any particular ordering.
| |||||||||||
SetMap(CollectionOrder keyOrder, CollectionOrder setOrder)
Create a new set-map.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | clear() | ||||||||||
boolean | containsKey(K key) | ||||||||||
boolean | containsValue(V value) | ||||||||||
boolean |
createKey(K key)
Create an explicit entry for a given key.
| ||||||||||
Set<V> | get(K key, boolean safe) | ||||||||||
Set<V> | get(K key) | ||||||||||
Set<V> | getSafe(K key) | ||||||||||
boolean | isEmpty() | ||||||||||
Set<K> |
keySet()
Retrieve a read-only view of the keys.
| ||||||||||
int | keySize() | ||||||||||
int |
put(K key, V value)
Add a key-value mapping.
| ||||||||||
void | putAll(Map<? extends K, List<? extends V>> m) | ||||||||||
void |
putMulti(K key, Collection<? extends V> values)
Add multiple elements mapped by the same key.
| ||||||||||
Set<V> | remove(K key) | ||||||||||
boolean |
removeAll(Collection<K> keys)
Remove all entries mapping to the collection of keys.
| ||||||||||
int | removeMulti(K key, Collection<? extends V> values) | ||||||||||
V | removeValue(K key, V value) | ||||||||||
int |
size()
Get the number of key-value mappings (per Map interface).
| ||||||||||
String | toString() | ||||||||||
Set<V> | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a new set-map without any particular ordering.
Create a new set-map.
keyOrder | key ordering |
---|---|
setOrder | value-set ordering |
Create an explicit entry for a given key. If no values mapped by the given key previously existed, the associated value will be an empty collection.
safe | if true, an empty collection of values is returned if the key does not exist |
---|
Retrieve a read-only view of the keys.
WARNING: This method does not respect the keySet()
contract: the set returned is
read-only.
Add a key-value mapping.
Add multiple elements mapped by the same key. Note that if an empty collection is provided, the entry for the provided key will not be be explicitly created.
Remove all entries mapping to the collection of keys.
Similar semantics as removeAll(Collection)
.
Get the number of key-value mappings (per Map interface). That is, the number of values.