![](../icons/Hazelcast-IMDG-Logo-Orange_Dark_200px.jpg) | IMapTKey, TValueReplace Method (TKey, TValue) |
Replaces the entry for a key only if currently mapped to some value.
Namespace:
Hazelcast.Core
Assembly:
Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.9.4
SyntaxTValue Replace(
TKey key,
TValue value
)
Function Replace (
key As TKey,
value As TValue
) As TValue
TValue Replace(
TKey key,
TValue value
)
abstract Replace :
key : 'TKey *
value : 'TValue -> 'TValue
Parameters
- key
- Type: TKey
key - value
- Type: TValue
value
Return Value
Type:
TValue previous value associated with
key or
null if there was no mapping for
key .
Remarks
Replaces the entry for a key only if currently mapped to some value.
This is equivalent to
if (map.ContainsKey(key))
return map.put(key, value);
else
return null;
>
except that the action is performed atomically.
Warning:
This method uses
GetHashCode and
Equals of binary form of
the
key, not the actual implementations of
GetHashCode and
Equals
defined in
key's class.
See Also