public interface SharedMap
Map interface, suitable for using as a
facade over RMI and GemFire versions of Map.
All operations will modify the underlying shared map, with the exception
of getMap(), which returns a copy that is not backed by the
shared map, but is useful for iterating over a snapshot of its contents.| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Equivalent of
Map.clear(). |
boolean |
containsKey(Object key)
Equivalent of
Map.containsKey(Object). |
boolean |
containsValue(Object value)
Equivalent of
Map.containsValue(Object). |
Object |
get(Object key)
Equivalent of
Map.get(Object). |
Map |
getMap()
Returns a copy of the underlying map.
|
Object |
getRandomKey()
Returns a random
key from this map.
|
boolean |
isEmpty()
Equivalent of
Map.isEmpty(). |
Object |
put(Object key,
Object value)
Equivalent of
Map.put(Object, Object). |
void |
putAll(Map t)
Equivalent of
Map.putAll(Map). |
long |
putIfLarger(Object key,
long value)
Replaces the current value with the specified one
if the specified one is larger than the current one.
|
long |
putIfSmaller(Object key,
long value)
Replaces the current value with the specified one
if the specified one is smaller than the current one.
|
Object |
remove(Object key)
Equivalent of
Map.remove(Object). |
boolean |
replace(Object key,
Object expectedValue,
Object newValue)
Performs an atomic "test and replace" on this map.
|
int |
size()
Equivalent of
Map.size(). |
int size()
Map.size().boolean isEmpty()
Map.isEmpty().boolean containsKey(Object key)
Map.containsKey(Object).boolean containsValue(Object value)
Map.containsValue(Object).Object get(Object key)
Map.get(Object).Object put(Object key, Object value)
Map.put(Object, Object).long putIfLarger(Object key, long value)
long putIfSmaller(Object key, long value)
Object remove(Object key)
Map.remove(Object).void putAll(Map t)
Map.putAll(Map).void clear()
Map.clear().Map getMap()
ConcurrentModificationException.
Note, however, that an iterator on this map is not backed by the
shared map. For example, the add and remove
operations on iterators will modify only the copy, not the shared map.Object getRandomKey()
null is
returned.
author David Whitlockboolean replace(Object key, Object expectedValue, Object newValue)
newValue will only be placed into this map only if the
current value of the mapping matches (is equals to)
expectedValue. This method is similar to the
replace method on the JSR-166
ConcurrentHashMap.key - The key of the mappingexpectedValue - The value that we expect the mapping to havenewValue - The new value put into the mapping if the current value
equals expectedValue.true if newValue was placed
into the map.
author David WhitlockCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.