|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.aavalla.utils.general.RetrievalAbstractMap<K,V>
net.aavalla.utils.general.RetrievalHashMap<K,V>
public class RetrievalHashMap<K,V>
RetrievalHashMap is an implementation of Map. All optional operations (adding and removing) are supported. Keys and values can be any objects.
Constructor Summary | |
---|---|
RetrievalHashMap()
Constructs a new empty RetrievalHashMap instance. |
|
RetrievalHashMap(int capacity)
Constructs a new RetrievalHashMap instance with the specified capacity. |
|
RetrievalHashMap(int capacity,
float loadFactor)
Constructs a new RetrievalHashMap instance with the specified capacity and
load factor. |
|
RetrievalHashMap(java.util.Map<? extends K,? extends V> map)
Constructs a new RetrievalHashMap instance containing the mappings from
the specified map. |
Method Summary | |
---|---|
void |
clear()
Removes all mappings from this hash map, leaving it empty. |
java.lang.Object |
clone()
Returns a shallow copy of this map. |
boolean |
containsKey(java.lang.Object key)
Returns whether this map contains the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns whether this map contains the specified value. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a set containing all of the mappings in this map. |
V |
get(java.lang.Object key)
Returns the value of the mapping with the specified key. |
K |
getKey(K templateKey)
Returns a key from this map that equals with the key given as argument or null, if none exist. |
boolean |
isEmpty()
Returns whether this map is empty. |
java.util.Set<K> |
keySet()
Returns a set of the keys contained in this map. |
V |
put(K key,
V value)
Maps the specified key to the specified value. |
void |
putAll(java.util.Map<? extends K,? extends V> map)
Copies all the mappings in the specified map to this map. |
V |
remove(java.lang.Object key)
Removes the mapping with the specified key from this map. |
int |
size()
Returns the number of elements in this map. |
java.util.Collection<V> |
values()
Returns a collection of the values contained in this map. |
Methods inherited from class net.aavalla.utils.general.RetrievalAbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public RetrievalHashMap()
RetrievalHashMap
instance.
public RetrievalHashMap(int capacity)
RetrievalHashMap
instance with the specified capacity.
capacity
- the initial capacity of this hash map.
java.lang.IllegalArgumentException
- when the capacity is less than zero.public RetrievalHashMap(int capacity, float loadFactor)
RetrievalHashMap
instance with the specified capacity and
load factor.
capacity
- the initial capacity of this hash map.loadFactor
- the initial load factor.
java.lang.IllegalArgumentException
- when the capacity is less than zero or the load factor is
less or equal to zero.public RetrievalHashMap(java.util.Map<? extends K,? extends V> map)
RetrievalHashMap
instance containing the mappings from
the specified map.
map
- the mappings to add.Method Detail |
---|
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class RetrievalAbstractMap<K,V>
isEmpty()
,
size()
public java.lang.Object clone()
clone
in class RetrievalAbstractMap<K,V>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class RetrievalAbstractMap<K,V>
key
- the key to search for.
true
if this map contains the specified key,
false
otherwise.public K getKey(K templateKey)
hashCode()
and equals()
are used in this comparison.
templateKey
- key template to search for
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
containsValue
in class RetrievalAbstractMap<K,V>
value
- the value to search for.
true
if this map contains the specified value,
false
otherwise.public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Map.Entry
. As the set is backed by this map,
changes in one will be reflected in the other.
entrySet
in interface java.util.Map<K,V>
entrySet
in class RetrievalAbstractMap<K,V>
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class RetrievalAbstractMap<K,V>
key
- the key.
null
if no mapping for the specified key is found.public boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
isEmpty
in class RetrievalAbstractMap<K,V>
true
if this map has no elements, false
otherwise.size()
public java.util.Set<K> keySet()
keySet
in interface java.util.Map<K,V>
keySet
in class RetrievalAbstractMap<K,V>
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class RetrievalAbstractMap<K,V>
key
- the key.value
- the value.
null
if there was no such mapping.public void putAll(java.util.Map<? extends K,? extends V> map)
putAll
in interface java.util.Map<K,V>
putAll
in class RetrievalAbstractMap<K,V>
map
- the map to copy mappings from.
java.lang.NullPointerException
- if map
is null
.public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class RetrievalAbstractMap<K,V>
key
- the key of the mapping to remove.
null
if no mapping
for the specified key was found.public int size()
size
in interface java.util.Map<K,V>
size
in class RetrievalAbstractMap<K,V>
public java.util.Collection<V> values()
This method returns a collection which is the subclass of
AbstractCollection. The iterator method of this subclass returns a
"wrapper object" over the iterator of map's entrySet(). The size
method wraps the map's size method and the contains
method wraps
the map's containsValue method.
The collection is created when this method is called for the first time and returned in response to all subsequent calls. This method may return different collections when multiple concurrent calls occur, since no synchronization is performed.
values
in interface java.util.Map<K,V>
values
in class RetrievalAbstractMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |