|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jjoost.collections.maps.base.AbstractHashMap<K,V,N>
org.jjoost.collections.maps.base.InlineListHashMap<K,V,N>
public class InlineListHashMap<K,V,N extends HashNode<N> & java.util.Map.Entry<K,V>>
| Method Summary | |
|---|---|
boolean |
add(K key,
V val)
Attempt to add the pair to the map, returning false if it could not be added, and true otherwise. |
java.lang.Iterable<V> |
apply(K v)
Returns the result of applying the function to the parameter |
ListMap<K,V> |
copy()
Returns a copy of the map. |
MultiSet<java.util.Map.Entry<K,V>> |
entries()
Returns a set representing all the key->value pairs in this map. |
MultiSet<K> |
keys()
Returns a set representing all the keys in the domain of this map. |
boolean |
permitsDuplicateKeys()
Returns true if a key can map to more than one value |
V |
put(K key,
V val)
Appends the provided key->value pair to the map; if equal pairs already exist they are not overridden, but co-exist with the new pair |
V |
putIfAbsent(K key,
V val)
Appends the provided key->value pair to the map if no pair exists where both key and value are equal to the one provided; otherwise the value of the first equal pair encountered is returned and the map is not modified |
int |
uniqueKeyCount()
Return an integer representing the number of unique keys in the domain of the map |
MultiSet<V> |
values(K key)
Returns a set representing the values associated with the provided key in this map. |
| Methods inherited from class org.jjoost.collections.maps.base.AbstractHashMap |
|---|
clear, clearAndReturn, contains, contains, count, count, entries, first, inverse, isEmpty, list, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, shrink, totalCount, values |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jjoost.collections.AnyMap |
|---|
clear, clearAndReturn, inverse, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, shrink, values |
| Methods inherited from interface org.jjoost.collections.AnyReadMap |
|---|
contains, contains, count, count, entries, first, isEmpty, list, totalCount |
| Method Detail |
|---|
public MultiSet<java.util.Map.Entry<K,V>> entries()
AnyReadMapListMap 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.
entries in interface AnyMap<K,V>entries in interface AnyReadMap<K,V>entries in interface ListMap<K,V>public MultiSet<K> keys()
AnyReadMapMultiMap 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.
keys in interface AnyMap<K,V>keys in interface AnyReadMap<K,V>keys in interface ListMap<K,V>
public boolean add(K key,
V val)
AnyMapfalse if it could not be added, and true otherwise. In a
ListMap the return value will always be true; however in a MultiMap it will be
false, and hence the map remain unmodified, if a pair whose key and value are both equal to the ones provided (as
determined by the map's definitions of equality) is already present; and in a Map it will be false if a
pair whose key is equal to the one provided is already present. When the value of the pair is inequal to null, this is
equivalent to put(key, value) == null
add in interface AnyMap<K,V>key - key to insertval - value to insert
true if the map was modified, false otherwise
public V put(K key,
V val)
ListMap
put in interface AnyMap<K,V>put in interface ListMap<K,V>key - the keyval - the val
public V putIfAbsent(K key,
V val)
ListMap
putIfAbsent in interface AnyMap<K,V>putIfAbsent in interface ListMap<K,V>key - the keyval - the val
public java.lang.Iterable<V> apply(K v)
Function
apply in interface Function<K,java.lang.Iterable<V>>v - something of type domain
public boolean permitsDuplicateKeys()
AnyReadMap
permitsDuplicateKeys in interface AnyReadMap<K,V>public int uniqueKeyCount()
AnyReadMap
uniqueKeyCount in interface AnyReadMap<K,V>public ListMap<K,V> copy()
AnyMap
copy in interface AnyMap<K,V>copy in interface ListMap<K,V>public MultiSet<V> values(K key)
AnyReadMap
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.
values in interface AnyMap<K,V>values in interface AnyReadMap<K,V>values in interface ListMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||