|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap
com.tangosol.util.AbstractKeySetBasedMap
public abstract class AbstractKeySetBasedMap
AbstractKeySetBasedMap is an extension to the AbstractKeyBasedMap that has a full awareness of the set of keys upon which the Map is based. As a result, it is possible to optimize the implementation of a number of methods that benefit from a knowledge of the entire set of keys.
Read-only implementations must implementgetInternalKeySet()
and
AbstractKeyBasedMap.get(Object)
. Read/write implementations must additionally
implement AbstractKeyBasedMap.put(Object, Object)
and AbstractKeyBasedMap.remove(Object)
. If the
implementation has any cost of returning an "old value", such as is done
by the Map.put(java.lang.Object, java.lang.Object)
and Map.remove(Object)
,
then the AbstractKeyBasedMap.putAll(java.util.Map)
and AbstractKeyBasedMap.removeBlind(Object)
methods should also be implemented. The only other obvious method for
optimization is AbstractKeyBasedMap.clear()
, if the implementation is able to do it
in bulk.
Nested Class Summary | |
---|---|
class |
AbstractKeySetBasedMap.EntrySet
A set of entries backed by this map. |
class |
AbstractKeySetBasedMap.KeyIterator
An iterator over the keys from the internal key Set that implements element removal via the Map's removeBlind method. |
protected class |
AbstractKeySetBasedMap.KeySet
A set of keys backed by this map. |
protected class |
AbstractKeySetBasedMap.ValuesCollection
A Collection of values backed by this map. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry |
Constructor Summary | |
---|---|
AbstractKeySetBasedMap()
|
Method Summary | |
---|---|
boolean |
containsKey(Object oKey)
Returns true if this map contains a mapping for the specified key. |
protected abstract Set |
getInternalKeySet()
Obtain a set of keys that are represented by this Map. |
protected Set |
instantiateEntrySet()
Factory pattern: Create a Set that represents the entries in the Map. |
protected Iterator |
instantiateKeyIterator()
Factory pattern: Create a mutable Iterator over the keys in the Map |
protected Set |
instantiateKeySet()
Factory pattern: Create a Set that represents the keys in the Map |
protected Collection |
instantiateValues()
Factory pattern: Instantiate the values Collection. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
protected boolean |
isInternalKeySetIteratorMutable()
Determine if this Iterator should remove an iterated item by calling remove on the internal key Set Iterator, or by calling removeBlind on the map itself. |
protected Iterator |
iterateKeys()
Create an iterator over the keys in this Map. |
int |
size()
Returns the number of key-value mappings in this map. |
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap |
---|
clear, clone, containsValue, entrySet, equals, get, getAll, hashCode, keySet, put, putAll, remove, removeBlind, toString, values |
Constructor Detail |
---|
public AbstractKeySetBasedMap()
Method Detail |
---|
public boolean containsKey(Object oKey)
containsKey
in interface Map
containsKey
in class AbstractKeyBasedMap
public boolean isEmpty()
isEmpty
in interface Map
isEmpty
in class AbstractKeyBasedMap
public int size()
size
in interface Map
size
in class AbstractKeyBasedMap
protected Iterator iterateKeys()
iterateKeys
in class AbstractKeyBasedMap
protected abstract Set getInternalKeySet()
protected boolean isInternalKeySetIteratorMutable()
AbstractKeyBasedMap.removeBlind(Object)
methodprotected Set instantiateKeySet()
instantiateKeySet
in class AbstractKeyBasedMap
protected Set instantiateEntrySet()
instantiateEntrySet
in class AbstractKeyBasedMap
protected Collection instantiateValues()
instantiateValues
in class AbstractKeyBasedMap
protected Iterator instantiateKeyIterator()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |