|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap
public abstract class AbstractKeyBasedMap
AbstractKeyBasedMap is a base class for Map implementations. The primary difference between the AbstractMap abstract class and this abstract class is this: that AbstractMap requires a sub-class to provide an Entry Set implementation, while AbstractKeyBasedMap requires a read-only sub-class to implement only get() and iterateKeys(), and a read-write sub-class to additionally implement only put() and remove().
Read-only implementations must implement iterateKeys() and get(Object). Read/write implementations must additionally implement put(Object, Object) and remove(Object). A number of the methods have implementations provided, but are extremely inefficient for Maps that contain large amounts of data, including clear(), containsKey(Object), size() (and by extension isEmpty()). Furthermore, if any of a number of method implementations has any cost of returning an "old value", such as is done by the put(java.lang.Object, java.lang.Object) and remove(Object) methods, then the putAll(java.util.Map) and removeBlind(Object) methods should also be implemented.
| Nested Class Summary | |
|---|---|
class |
AbstractKeyBasedMap.EntrySetA set of entries backed by this map. |
protected class |
AbstractKeyBasedMap.KeySetA set of keys backed by this map. |
protected class |
AbstractKeyBasedMap.ValuesCollectionA Collection of values backed by this map. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry |
| Constructor Summary | |
|---|---|
AbstractKeyBasedMap() |
|
| Method Summary | |
|---|---|
void |
clear()Clear all key/value mappings. |
protected java.lang.Object |
clone()Returns a shallow copy of this AbstractKeyBasedMap instance; the keySet, entrySet and values collections are not cloned or copied to (shared by) the clone. |
boolean |
containsKey(java.lang.Object oKey)Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object oValue)Returns true if this Map maps one or more keys to the specified value. |
java.util.Set |
entrySet()Returns a set view of the mappings contained in this map. |
boolean |
equals(java.lang.Object o)Compares the specified object with this map for equality. |
abstract java.lang.Object |
get(java.lang.Object oKey)Returns the value to which this map maps the specified key. |
java.util.Map |
getAll(java.util.Collection colKeys)Get all the specified keys, if they are in the Map. |
int |
hashCode()Returns the hash code value for this Map. |
protected java.util.Set |
instantiateEntrySet()Factory pattern: Create a Set that represents the entries in the Map. |
protected java.util.Set |
instantiateKeySet()Factory pattern: Create a Set that represents the keys in the Map |
protected java.util.Collection |
instantiateValues()Factory pattern: Instantiate the values Collection. |
boolean |
isEmpty()Returns true if this map contains no key-value mappings. |
protected abstract java.util.Iterator |
iterateKeys()Create an iterator over the keys in this Map. |
java.util.Set |
keySet()Returns a set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue)Associates the specified value with the specified key in this map. |
void |
putAll(java.util.Map map)Copies all of the mappings from the specified map to this map. |
java.lang.Object |
remove(java.lang.Object oKey)Removes the mapping for this key from this map if present. |
protected boolean |
removeBlind(java.lang.Object oKey)Removes the mapping for this key from this map if present. |
int |
size()Returns the number of key-value mappings in this map. |
java.lang.String |
toString()Returns a string representation of this Map. |
java.util.Collection |
values()Returns a collection view of the values contained in this map. |
| Constructor Detail |
|---|
public AbstractKeyBasedMap()
| Method Detail |
|---|
public void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object oKey)
containsKey in interface java.util.Mappublic boolean containsValue(java.lang.Object oValue)
containsValue in interface java.util.Mappublic java.util.Set entrySet()
AbstractKeyBasedMap.EntrySet.Entry. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except by the iterator's own remove operation, or by the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It is not expected to support the add or addAll operations.entrySet in interface java.util.Mappublic abstract java.lang.Object get(java.lang.Object oKey)
get in interface java.util.MapoKey - the key objectpublic boolean isEmpty()
isEmpty in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Map
public java.lang.Object put(java.lang.Object oKey,
java.lang.Object oValue)
put in interface java.util.MapoKey - key with which the specified value is to be associatedoValue - value to be associated with the specified keypublic void putAll(java.util.Map map)
put(java.lang.Object, java.lang.Object) on this map once for each mapping in the passed map. The behavior of this operation is unspecified if the passed map is modified while the operation is in progress.putAll in interface java.util.Mapmap - the Map containing the key/value pairings to put into this Mappublic java.lang.Object remove(java.lang.Object oKey)
remove in interface java.util.MapoKey - key whose mapping is to be removed from the mappublic int size()
size in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic java.util.Map getAll(java.util.Collection colKeys)
colKeys - a collection of keys that may be in the named cacheprotected abstract java.util.Iterator iterateKeys()
protected boolean removeBlind(java.lang.Object oKey)
oKey - key whose mapping is to be removed from the mappublic boolean equals(java.lang.Object o)
equals in interface java.util.Mapo - object to be compared for equality with this Mappublic int hashCode()
hashCode in interface java.util.Mappublic java.lang.String toString()
protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedExceptionprotected java.util.Set instantiateKeySet()
protected java.util.Set instantiateEntrySet()
protected java.util.Collection instantiateValues()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||