|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractMap
com.tangosol.util.NullImplementation.NullMap
public static class NullImplementation.NullMap
A Map that contains nothing and does nothing.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry |
Field Summary | |
---|---|
static Map |
INSTANCE Since the Map contains no information, only one ever has to exist. |
Constructor Summary | |
---|---|
NullImplementation.NullMap() Default constructor (for ExternalizableLite and PortableObject). |
Method Summary | |
---|---|
boolean |
containsKey(Object key) Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(Object value) Returns true if this map maps one or more keys to this value. |
Set |
entrySet() Returns a set view of the mappings contained in this map. |
boolean |
equals(Object o) Compares the specified object with this map for equality. |
Object |
get(Object key) Returns the value to which this map maps the specified key. |
int |
hashCode() Returns the hash code value for this map. |
Set |
keySet() Returns a Set view of the keys contained in this map. |
Object |
put(Object key, Object value) Associates the specified value with the specified key in this map (optional operation). |
void |
putAll(Map map) Copies all of the mappings from the specified map to this map (optional operation). |
void |
readExternal(DataInput in) Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(PofReader in) Restore the contents of a user type instance by reading its state using the specified PofReader object. |
Object |
remove(Object key) Removes the mapping for this key from this map if present (optional operation). |
int |
size() Returns the number of key-value mappings in this map. |
Collection |
values() Returns a collection view of the values contained in this map. |
void |
writeExternal(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object. |
Methods inherited from class java.util.AbstractMap |
---|
clear, clone, isEmpty, toString |
Methods inherited from interface java.util.Map |
---|
clear, isEmpty |
Field Detail |
---|
public static final Map INSTANCE
Constructor Detail |
---|
public NullImplementation.NullMap()
Method Detail |
---|
public int size()
java.util.AbstractMap
This implementation returns entrySet().size().
size
in interface Map
size
in class AbstractMap
public Object get(Object key)
java.util.AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, the entry's value is returned. If the iteration terminates without finding such an entry, null is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
get
in interface Map
get
in class AbstractMap
key
- key whose associated value is to be returned.AbstractMap.containsKey(Object)
public Object put(Object key, Object value)
java.util.AbstractMap
This implementation always throws an UnsupportedOperationException.
put
in interface Map
put
in class AbstractMap
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.public void putAll(Map map)
java.util.AbstractMap
This implementation iterates over the specified map's entrySet() collection, and calls this map's put operation once for each entry returned by the iteration.
Note that this implementation throws an UnsupportedOperationException if this map does not support the put operation and the specified map is nonempty.
putAll
in interface Map
putAll
in class AbstractMap
map
- mappings to be stored in this map.public Object remove(Object key)
java.util.AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, its value is obtained with its getValue operation, the entry is removed from the Collection (and the backing map) with the iterator's remove operation, and the saved value is returned. If the iteration terminates without finding such an entry, null is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
Note that this implementation throws an UnsupportedOperationException if the entrySet iterator does not support the remove method and this map contains a mapping for the specified key.
remove
in interface Map
remove
in class AbstractMap
key
- key whose mapping is to be removed from the map.public boolean containsKey(Object key)
java.util.AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, true is returned. If the iteration terminates without finding such an entry, false is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
containsKey
in interface Map
containsKey
in class AbstractMap
key
- key whose presence in this map is to be tested.public boolean containsValue(Object value)
java.util.AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified value. If such an entry is found, true is returned. If the iteration terminates without finding such an entry, false is returned. Note that this implementation requires linear time in the size of the map.
containsValue
in interface Map
containsValue
in class AbstractMap
value
- value whose presence in this map is to be tested.public Set entrySet()
java.util.AbstractMap
entrySet
in interface Map
entrySet
in class AbstractMap
public Set keySet()
java.util.AbstractMap
This implementation returns a Set that subclasses AbstractSet. The subclass's iterator method returns a "wrapper object" over this map's entrySet() iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsKey method.
The Set is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Set.
keySet
in interface Map
keySet
in class AbstractMap
public Collection values()
java.util.AbstractMap
This implementation returns a collection that subclasses abstract collection. The subclass's iterator method returns a "wrapper object" over this map's entrySet() iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsValue method.
The collection is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Collection.
values
in interface Map
values
in class AbstractMap
public boolean equals(Object o)
java.util.AbstractMap
This implementation first checks if the specified object is this map; if so it returns true. Then, it checks if the specified object is a map whose size is identical to the size of this set; if not, it returns false. If so, it iterates over this map's entrySet collection, and checks that the specified map contains each mapping that this map contains. If the specified map fails to contain such a mapping, false is returned. If the iteration completes, true is returned.
equals
in interface Map
equals
in class AbstractMap
o
- object to be compared for equality with this map.public int hashCode()
java.util.AbstractMap
This implementation iterates over entrySet(), calling hashCode on each element (entry) in the Collection, and adding up the results.
hashCode
in interface Map
hashCode
in class AbstractMap
Map.Entry.hashCode()
, Object.hashCode()
, Object.equals(Object)
, Set.equals(Object)
public void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore the state of this objectIOException
- if an I/O exception occursNotActiveException
- if the object is not in its initial state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object toIOException
- if an I/O exception occurspublic void readExternal(PofReader in) throws IOException
readExternal
in interface PortableObject
in
- the PofReader from which to read the object's stateIOException
- if an I/O error occurspublic void writeExternal(PofWriter out) throws IOException
writeExternal
in interface PortableObject
out
- the PofWriter to which to write the object's stateIOException
- if an I/O error occurs
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |