|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.extend.server.support.EnhancedMap<KeyType,ValueType>
public class EnhancedMap<KeyType,ValueType>
This map maintains separate set of values. This allows if two key/value pairs contain same
value and remove(Object)
method is called with value both values are going to be
removed from the map. Also, having set of values values()
method returns that
set which is faster. Values set is implemented as LinkedHashSet
Nested Class Summary | |
---|---|
protected class |
EnhancedMap.InternalSet<Type>
Internal implementation of LinkedHashSet so invoking HashSet.remove(Object)
method removes all values from the map as well |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary | |
---|---|
protected LinkedHashMap<KeyType,ValueType> |
map
Map |
protected EnhancedMap.InternalSet<ValueType> |
values
Values |
Constructor Summary | |
---|---|
EnhancedMap()
Empty constractor |
Method Summary | |
---|---|
void |
clear()
Clears the map. |
boolean |
containsKey(Object key)
Checks map if key exsits |
boolean |
containsValue(Object value)
Checks values set if value exsits |
Set<Map.Entry<KeyType,ValueType>> |
entrySet()
Returns entry set of a map |
ValueType |
get(Object key)
Returns get value |
boolean |
isEmpty()
Returns if is empty |
Set<KeyType> |
keySet()
Returns key set |
static void |
main(String[] args)
|
ValueType |
put(KeyType key,
ValueType value)
Adds new element to the map |
void |
putAll(Map<? extends KeyType,? extends ValueType> t)
Stores all |
ValueType |
remove(Object value)
Removes value value |
int |
size()
Returns map size |
Collection<ValueType> |
values()
Returns values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
protected LinkedHashMap<KeyType,ValueType> map
protected EnhancedMap.InternalSet<ValueType> values
Constructor Detail |
---|
public EnhancedMap()
Method Detail |
---|
public ValueType get(Object key)
get
in interface Map<KeyType,ValueType>
key
- key
public ValueType put(KeyType key, ValueType value)
put
in interface Map<KeyType,ValueType>
key
- keyvalue
- value
public ValueType remove(Object value)
remove
in interface Map<KeyType,ValueType>
value
- value to be removed
true
if removedpublic void clear()
clear
in interface Map<KeyType,ValueType>
public Collection<ValueType> values()
values
in interface Map<KeyType,ValueType>
public boolean containsKey(Object key)
containsKey
in interface Map<KeyType,ValueType>
key
- key
true
if key existspublic boolean containsValue(Object value)
containsValue
in interface Map<KeyType,ValueType>
value
- value
true
if value existspublic Set<Map.Entry<KeyType,ValueType>> entrySet()
entrySet
in interface Map<KeyType,ValueType>
public boolean isEmpty()
isEmpty
in interface Map<KeyType,ValueType>
true
if is emptypublic Set<KeyType> keySet()
keySet
in interface Map<KeyType,ValueType>
public void putAll(Map<? extends KeyType,? extends ValueType> t)
putAll
in interface Map<KeyType,ValueType>
t
- mappublic int size()
size
in interface Map<KeyType,ValueType>
public static void main(String[] args) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |