|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AnyReadMap<K,V>
This interface is the common ancestor of all Jjoost maps.
The methods declared here make no assumptions about the number of occurences of a given key or key->value pair, and declare no actions that may modify the map, so is the most general form of map. No concrete class should implement this interface directly.
WARNING: Note that in a MultiMap and ListMap the
keys() method returns a MultiSet and as such an
Iterator over this will yield each duplicate key the number of
times it occurs in the map. For unique keys, call
keys().unique()
Also note that an Iterator returned by concurrent implementors
of this class is permitted to return values more times than they actually
ever occurred if a valid sequence of deletes and inserts happens to
cause the Iterator to see the values multiple times. See the
javadoc of the implementing classes to determine their behaviour in this
case.
| Method Summary | |
|---|---|
boolean |
contains(K key)
Returns true iff a key occurs in the map which is equal to the parameter, as determined by the map's definition of equality. |
boolean |
contains(K key,
V val)
Returns true iff a (key,value) pair occurs in the map that is equal to those provided, as determined by the map's definition(s) of equality. |
int |
count(K key)
Returns the number of occurrences of keys present in the map that are equal to the one provided, as determined by the map's definition of equality. |
int |
count(K key,
V val)
Returns the number of occurrences of (key, value) pairs present in the map that are equal to the one provided, as determined by the map's definition(s) of equality. |
AnyReadSet<? extends java.util.Map.Entry<K,V>> |
entries()
Returns a set representing all the key->value pairs in this map. |
java.lang.Iterable<java.util.Map.Entry<K,V>> |
entries(K key)
Returns an Iterable over all key->value maplets in the map
whose key is equal to the one provided, as determined by the map's
definition of equality. |
V |
first(K key)
Returns the value associated with the first key that is equal to the one provided, as determined by the map's definition of equality. |
boolean |
isEmpty()
Returns true iff the map is empty |
AnyReadSet<K> |
keys()
Returns a set representing all the keys in the domain of this map. |
java.util.List<V> |
list(K key)
Returns a List of all values in the map which are mapped to by
the provided key, as determined by the map's definition of equality. |
boolean |
permitsDuplicateKeys()
Returns true if a key can map to more than one value |
int |
totalCount()
Return an integer representing the total number of maplets (i.e. |
int |
uniqueKeyCount()
Return an integer representing the number of unique keys in the domain of the map |
AnyReadSet<V> |
values()
Returns a set representing the range of the map. |
AnyReadSet<V> |
values(K key)
Returns a set representing the values associated with the provided key in this map. |
| Method Detail |
|---|
boolean contains(K key)
key - find
boolean contains(K key,
V val)
key - the keyval - the val
int count(K key)
key - the key
int count(K key,
V val)
key - the keyval - the val
V first(K key)
null if no matching key
is found.
key - the key
AnyReadSet<V> values(K key)
Note that in a regular (scalar) map the set returned will be a
UnitarySet, which contains at most one value.
put() operations on such a set will override any existing
value regardless of if it is equal to the one already present.
java.util.List<V> list(K key)
List of all values in the map which are mapped to by
the provided key, as determined by the map's definition of equality. This list
should be constructed "eagerly" and should be a consistent snapshot of
the values valid at some point between the method being called and it returning.
key - the key
AnyReadSet<K> keys()
MultiMap or ListMap this will be a
MultiSet. This set should always reflect changes to the map,
and changes to the set should be reflected in the map also. Otherwise,
this set should behave exactly as a regular set does. The key equality used
by this map can be obtained from this set.
Depending on the implementation of map, this key set may contain every occurrence of equal keys provided to the map, or may contain a subset thereof with repetitions to bring the number of occurrences in line with the number provided.
Note that the put() methods on this set will always fail,
because no value can be provided to update the map with.
AnyReadSet<? extends java.util.Map.Entry<K,V>> entries()
ListMap this will be a MultiSet. This set
should always reflect changes to the map, and changes to the set should
be reflected in the map also. Otherwise, this set should behave exactly
as a regular set does.
AnyReadSet<V> values()
java.lang.Iterable<java.util.Map.Entry<K,V>> entries(K key)
Iterable over all key->value maplets in the map
whose key is equal to the one provided, as determined by the map's
definition of equality.
key - find
int totalCount()
int uniqueKeyCount()
boolean isEmpty()
boolean permitsDuplicateKeys()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||