|
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
com.tangosol.util.Base
com.tangosol.util.SimpleMapEntry
public class SimpleMapEntry
A map entry (key-value pair). The Map.entrySet method returns a collection-view of the map, whose elements are of this class. The only way to obtain a reference to a map entry is from the iterator of this collection-view. These Map.Entry objects are valid only for the duration of the iteration; more formally, the behavior of a map entry is undefined if the backing map has been modified after the entry was returned by the iterator, except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator.
Field Summary | |
---|---|
protected Object |
m_oKey The key. |
protected Object |
m_oOrigValue The original value. |
protected Object |
m_oValue The value. |
protected static Object |
NO_VALUE Constant used to indicate that the original value does not exist. |
Constructor Summary | |
---|---|
protected |
SimpleMapEntry() Default constructor. |
|
SimpleMapEntry(Map.Entry entry) Copy constructor. |
protected |
SimpleMapEntry(Object oKey) Construct a SimpleMapEntry with just a key. |
|
SimpleMapEntry(Object oKey, Object oValue) Construct a SimpleMapEntry with a key and a value. |
|
SimpleMapEntry(Object oKey, Object oValue, Object oOrigValue) Construct a SimpleMapEntry with a key, value and original value. |
Method Summary | |
---|---|
Object |
clone() Clone the Entry. |
boolean |
equals(Object o) Compares the specified object with this entry for equality. |
Object |
extract(ValueExtractor extractor) Extract a value out of the Entry's value. |
Object |
getKey() Returns the key corresponding to this entry. |
Object |
getOriginalValue() Determine the value that existed before the start of the mutating operation that is being evaluated by the trigger. |
Object |
getValue() Returns the value corresponding to this entry. |
int |
hashCode() Returns the hash code value for this map entry. |
boolean |
isOriginalPresent() Determine whether or not the Entry existed before the start of the mutating operation that is being evaluated by the trigger. |
boolean |
isPresent() Determine if this Entry exists in the Map. |
void |
remove(boolean fSynthetic) Remove this Entry from the Map if it is present in the Map. |
Object |
setValue(Object oValue) Replaces the value corresponding to this entry with the specified value (optional operation). |
void |
setValue(Object oValue, boolean fSynthetic) Store the value corresponding to this entry. |
String |
toString() Render the map entry as a String. |
void |
update(ValueUpdater updater, Object oValue) Update the Entry's value. |
Field Detail |
---|
protected static final Object NO_VALUE
protected Object m_oKey
protected Object m_oValue
protected Object m_oOrigValue
Constructor Detail |
---|
protected SimpleMapEntry()
protected SimpleMapEntry(Object oKey)
oKey
- an object for the keypublic SimpleMapEntry(Map.Entry entry)
entry
- an entry to copy frompublic SimpleMapEntry(Object oKey, Object oValue)
oKey
- an object for the keyoValue
- an object for the valuepublic SimpleMapEntry(Object oKey, Object oValue, Object oOrigValue)
oKey
- an object for the keyoValue
- an object for the valueoOrigValue
- an object for the original valueMethod Detail |
---|
public Object getKey()
getKey
in interface InvocableMap.Entry
getKey
in interface Map.Entry
public Object getValue()
getValue
in interface InvocableMap.Entry
getValue
in interface Map.Entry
public Object setValue(Object oValue)
setValue
in interface InvocableMap.Entry
setValue
in interface Map.Entry
oValue
- new value to be stored in this entrypublic Object getOriginalValue()
MapTrigger.Entry
getOriginalValue
in interface MapTrigger.Entry
public boolean isOriginalPresent()
MapTrigger.Entry
isOriginalPresent
in interface MapTrigger.Entry
public void setValue(Object oValue, boolean fSynthetic)
InvocableMap.Entry
setValue
, this form does not return the previous value, and as a result may be significantly less expensive (in terms of cost of execution) for certain Map implementations.setValue
in interface InvocableMap.Entry
oValue
- the new value for this EntryfSynthetic
- pass true only if the insertion into or modification of the Map should be treated as a synthetic eventpublic void update(ValueUpdater updater, Object oValue)
InvocableMap.Entry
Object oTarget = entry.getValue(); updater.update(oTarget, oValue); entry.setValue(oTarget, false);The benefit of using this method is that it may allow the Entry implementation to significantly optimize the operation, such as for purposes of delta updates and backup maintenance.
update
in interface InvocableMap.Entry
updater
- a ValueUpdater used to modify the Entry's valueoValue
- the new value for this Entrypublic boolean isPresent()
InvocableMap.Entry
InvocableMap.Entry.setValue(java.lang.Object)
or InvocableMap.Entry.setValue(java.lang.Object)
. If the Entry is present, it can be destroyed by calling InvocableMap.Entry.remove(boolean)
.isPresent
in interface InvocableMap.Entry
public void remove(boolean fSynthetic)
InvocableMap.Entry
Map.remove(java.lang.Object)
as well as synthetic operations such as eviction. If the containing Map does not differentiate between the two, then this method will always be identical to InvocableMap.this.remove(getKey()).remove
in interface InvocableMap.Entry
fSynthetic
- pass true only if the removal from the Map should be treated as a synthetic eventpublic Object extract(ValueExtractor extractor)
QueryMap.Entry
extract
in interface QueryMap.Entry
extractor
- a ValueExtractor to apply to the Entry's valuepublic boolean equals(Object o)
(e1.getKey()==null ? e2.getKey()==null : e1.getKey().equals(e2.getKey())) && (e1.getValue()==null ? e2.getValue()==null : e1.getValue().equals(e2.getValue()))This ensures that the equals method works properly across different implementations of the Map.Entry interface.
equals
in interface Map.Entry
o
- object to be compared for equality with this map entrypublic int hashCode()
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 : e.getValue().hashCode())This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
hashCode
in interface Map.Entry
Object.hashCode()
, Object.equals(Object)
, Map.Entry.equals(Object)
public String toString()
public Object clone()
|
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 |