K
- KeyV
- Valuepublic interface BaseMap<K,V> extends DistributedObject
IMap
,
TransactionalMap
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Object key)
Returns
true if this map contains an entry for the specified
key. |
void |
delete(Object key)
Removes the mapping for a key from this map if it is present.
|
V |
get(Object key)
Returns the value for the specified key, or
null if this map does not contain this key. |
boolean |
isEmpty()
Returns true if this map contains no entries.
|
Set<K> |
keySet()
Returns a set clone of the keys contained in this map.
|
Set<K> |
keySet(Predicate predicate)
Queries the map based on the specified predicate and
returns the keys of matching entries.
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
V |
put(K key,
V value,
long ttl,
TimeUnit timeunit)
Associates the specified value with the specified key in this map
with a given ttl (time to live) value.
|
V |
putIfAbsent(K key,
V value)
If the specified key is not already associated
with a value, associate it with the given value.
|
V |
remove(Object key)
Removes the mapping for a key from this map if it is present.
|
boolean |
remove(Object key,
Object value)
Removes the entry for a key only if currently mapped to a given value.
|
V |
replace(K key,
V value)
Replaces the entry for a key only if it is currently mapped to some value.
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replaces the entry for a key only if currently mapped to a given value.
|
void |
set(K key,
V value)
Associates the specified value with the specified key in this map.
|
int |
size()
Returns the number of entries in this map.
|
Collection<V> |
values()
Returns a collection clone of the values contained in this map.
|
Collection<V> |
values(Predicate predicate)
Queries the map based on the specified predicate and
returns the values of matching entries.
|
destroy, getName, getPartitionKey, getServiceName
boolean containsKey(Object key)
true
if this map contains an entry for the specified
key.key
- The specified key.true
if this map contains an entry for the specified key.V get(Object key)
null
if this map does not contain this key.key
- The specified key.V put(K key, V value)
key
- The specified key.value
- The value to associate with the key.key
or null
if there was no mapping for key
.V put(K key, V value, long ttl, TimeUnit timeunit)
key
- The specified key.value
- The value to associate with the key.ttl
- maximum time for this entry to stay in the map
0 means infinite.timeunit
- time unit for the ttlkey
or null
if there was no mapping for key
.void set(K key, V value)
put(Object, Object)
if the old value is not needed.key
- The specified key.value
- The value to associate with the key.V putIfAbsent(K key, V value)
if (!map.containsKey(key)) return map.put(key, value); else return map.get(key);except that the action is performed atomically.
key
- The specified key.value
- The value to associate with the key when there is no previous value.key
, or null
if there was no mapping for key
.V replace(K key, V value)
if (map.containsKey(key)) { return map.put(key, value); } else return null;except that the action is performed atomically.
key
- The specified key.value
- The value to replace the previous value.key
, or null
if there was no mapping for key
.boolean replace(K key, V oldValue, V newValue)
if (map.containsKey(key) && map.get(key).equals(oldValue)) { map.put(key, newValue); return true; } else return false;except that the action is performed atomically.
key
- The specified key.oldValue
- Replace the key value if it is the old value.newValue
- The new value to replace the old value.true
if the value was replaced.V remove(Object key)
The map will not contain a mapping for the specified key once the call returns.
key
- Remove the mapping for this key.key
, or null
if there was no mapping for key
.void delete(Object key)
The map will not contain a mapping for the specified key once the call returns.
* This method is preferred to remove(Object)
if the old value is not needed.
key
- Remove the mapping for this key.boolean remove(Object key, Object value)
if (map.containsKey(key) && map.get(key).equals(value)) { map.remove(key); return true; } else return false;except that the action is performed atomically.
key
- The specified key.value
- Remove the key if it has this value.true
if the value was removed.boolean isEmpty()
int size()
Set<K> keySet()
Set<K> keySet(Predicate predicate)
predicate
- specified query criteria.NullPointerException
- if the specified predicate is null.Collection<V> values()
Collection<V> values(Predicate predicate)
predicate
- specified query criteria.NullPointerException
- if the predicate is nullCopyright © 2018 Hazelcast, Inc.. All rights reserved.