Package com.tangosol.util
Class InvocableMapHelper.SimpleEntry<K,V>
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.SimpleMapEntry<K,V>
com.tangosol.util.InvocableMapHelper.SimpleEntry<K,V>
- All Implemented Interfaces:
InvocableMap.Entry<K,
,V> MapTrigger.Entry<K,
,V> QueryMap.Entry<K,
,V> Serializable
,Cloneable
,Map.Entry<K,
V>
- Enclosing class:
InvocableMapHelper
Simple implementation of the InvocableMap.Entry interface.
This assumes that the underlying Map content does not change while a
reference to the SimpleEntry is alive and may cache the entry's value to
avoid an extra map lookup.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Fields inherited from class com.tangosol.util.SimpleMapEntry
m_oKey, m_oOrigValue, m_oValue, NO_VALUE
-
Constructor Summary
ConstructorDescriptionSimpleEntry
(Map<K, V> map, K oKey, boolean fReadOnly) Construct a SimpleEntry for a given map and a key.Construct a SimpleEntry for a given key and value.SimpleEntry
(K oKey, V oValue) Construct a SimpleEntry for a given key and value. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Verify that this SimpleEntry is mutable.boolean
Compare this SimpleEntry with another object for equality.getValue()
Returns the value corresponding to this entry.int
hashCode()
Return a hash code value for the SimpleEntry object.boolean
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.Replaces the value corresponding to this entry with the specified value (optional operation).void
Store the value corresponding to this entry.toString()
Provide a human-readable representation of the SimpleEntry object.Methods inherited from class com.tangosol.util.SimpleMapEntry
clone, extract, getKey, getOriginalValue, isOriginalPresent, isSynthetic, update
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tangosol.util.InvocableMap.Entry
asBinaryEntry, getValue, getValue
Methods inherited from interface com.tangosol.util.QueryMap.Entry
extractFromKey, extractFromValue
-
Field Details
-
m_map
The map.
-
-
Constructor Details
-
SimpleEntry
Construct a SimpleEntry for a given map and a key.- Parameters:
map
- the parent Map for this entryoKey
- the entry's keyfReadOnly
- if true, the entry will be marked as read-only, preventing the setValue() and remove() methods from modifying the underlying map's content
-
SimpleEntry
Construct a SimpleEntry for a given key and value.- Parameters:
map
- the parent Map for this entryoKey
- the entry's keyoValue
- the entry's valuefReadOnly
- if true, the entry will be marked as read-only, preventing the setValue() and remove() methods from modifying the underlying map's content
-
SimpleEntry
Construct a SimpleEntry for a given key and value. The entry will be marked as read-only.- Parameters:
oKey
- the entry's keyoValue
- the entry's value
-
-
Method Details
-
getValue
Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined. -
setValue
Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation). -
setValue
Store the value corresponding to this entry. If the entry does not exist, then the entry will be created by invoking this method, even with a null value (assuming the Map supports null values).Unlike the other form of
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.- Specified by:
setValue
in interfaceInvocableMap.Entry<K,
V> - Overrides:
setValue
in classSimpleMapEntry<K,
V> - Parameters:
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 event
-
isPresent
public boolean isPresent()Determine if this Entry exists in the Map. If the Entry is not present, it can be created by callingInvocableMap.Entry.setValue(Object)
orInvocableMap.Entry.setValue(Object, boolean)
. If the Entry is present, it can be destroyed by callingInvocableMap.Entry.remove(boolean)
.- Specified by:
isPresent
in interfaceInvocableMap.Entry<K,
V> - Overrides:
isPresent
in classSimpleMapEntry<K,
V> - Returns:
- true iff this Entry is existent in the containing Map
-
remove
public void remove(boolean fSynthetic) Remove this Entry from the Map if it is present in the Map.This method supports both the operation corresponding to
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()).- Specified by:
remove
in interfaceInvocableMap.Entry<K,
V> - Overrides:
remove
in classSimpleMapEntry<K,
V> - Parameters:
fSynthetic
- pass true only if the removal from the Map should be treated as a synthetic event
-
equals
Compare this SimpleEntry with another object for equality. -
hashCode
public int hashCode()Return a hash code value for the SimpleEntry object. -
toString
Provide a human-readable representation of the SimpleEntry object.- Overrides:
toString
in classSimpleMapEntry<K,
V> - Returns:
- a String representation of this SimpleEntry object
-
checkMutable
protected void checkMutable()Verify that this SimpleEntry is mutable.
-