Interface RMultimap<K,V>
- Type Parameters:
K- keyV- value
- All Superinterfaces:
RExpirable,RExpirableAsync,RMultimapAsync<K,,V> RObject,RObjectAsync
- All Known Subinterfaces:
RListMultimap<K,,V> RListMultimapCache<K,,V> RListMultimapCacheNative<K,,V> RMultimapCache<K,,V> RSetMultimap<K,,V> RSetMultimapCache<K,,V> RSetMultimapCacheNative<K,V>
- All Known Implementing Classes:
RedissonListMultimap,RedissonListMultimapCache,RedissonListMultimapCacheNative,RedissonMultimap,RedissonSetMultimap,RedissonSetMultimapCache,RedissonSetMultimapCacheNative
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all key-value pairs from the multimap, leaving it empty.booleancontainsEntry(Object key, Object value) Returnstrueif this multimap contains at least one key-value pair with the keykeyand the valuevalue.booleancontainsKey(Object key) Returnstrueif this multimap contains at least one key-value pair with the keykey.booleancontainsValue(Object value) Returnstrueif this multimap contains at least one key-value pair with the valuevalue.entries()Returns a view collection of all key-value pairs contained in this multimap, asMap.Entryinstances.longfastRemove(K... keys) Removeskeysfrom map by one operation Works faster thanRMultimap.removebut not returning the value associated withkeylongfastRemoveValue(V... values) Removesvaluesfrom map by one operationReturns a view collection of the values associated withkeyin this multimap, if any.Returns all elements at once.getCountDownLatch(K key) ReturnsRCountDownLatchinstance associated with keygetFairLock(K key) ReturnsRLockinstance associated with keyReturnsRLockinstance associated with keyReturnsRPermitExpirableSemaphoreinstance associated with keygetReadWriteLock(K key) ReturnsRReadWriteLockinstance associated with keygetSemaphore(K key) ReturnsRSemaphoreinstance associated with keybooleanisEmpty()Check is map emptykeySet()Returns a view collection of all distinct keys contained in this multimap.intkeySize()Returns the count of distinct keys in this multimap.booleanStores a key-value pair in this multimap.booleanStores a key-value pair in this multimap for each ofvalues, all using the same key,key.Read all keys at oncebooleanRemoves a single key-value pair with the keykeyand the valuevaluefrom this multimap, if such exists.Removes all values associated with the keykey.replaceValues(K key, Iterable<? extends V> values) Stores a collection of values with the same key, replacing any existing values for that key.intsize()Returns the number of key-value pairs in this multimap.values()Returns a view collection containing the value from each key-value pair contained in this multimap, without collapsing duplicates (sovalues().size() == size()).Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods inherited from interface org.redisson.api.RMultimapAsync
containsEntryAsync, containsKeyAsync, containsValueAsync, fastRemoveAsync, fastRemoveValueAsync, getAllAsync, keySizeAsync, putAllAsync, putAsync, readAllKeySetAsync, removeAllAsync, removeAsync, replaceValuesAsync, sizeAsyncMethods inherited from interface org.redisson.api.RObject
addListener, copy, copy, copy, copyAndReplace, copyAndReplace, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
getCountDownLatch
ReturnsRCountDownLatchinstance associated with key- Parameters:
key- - map key- Returns:
- countdownlatch
-
getPermitExpirableSemaphore
ReturnsRPermitExpirableSemaphoreinstance associated with key- Parameters:
key- - map key- Returns:
- permitExpirableSemaphore
-
getSemaphore
ReturnsRSemaphoreinstance associated with key- Parameters:
key- - map key- Returns:
- semaphore
-
getFairLock
ReturnsRLockinstance associated with key- Parameters:
key- - map key- Returns:
- fairlock
-
getReadWriteLock
ReturnsRReadWriteLockinstance associated with key- Parameters:
key- - map key- Returns:
- readWriteLock
-
getLock
ReturnsRLockinstance associated with key- Parameters:
key- - map key- Returns:
- lock
-
size
int size()Returns the number of key-value pairs in this multimap.- Returns:
- size of multimap
-
isEmpty
boolean isEmpty()Check is map empty- Returns:
trueif empty
-
containsKey
Returnstrueif this multimap contains at least one key-value pair with the keykey.- Parameters:
key- - map key- Returns:
trueif contains a key
-
containsValue
Returnstrueif this multimap contains at least one key-value pair with the valuevalue.- Parameters:
value- - map value- Returns:
trueif contains a value
-
containsEntry
Returnstrueif this multimap contains at least one key-value pair with the keykeyand the valuevalue.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif contains an entry
-
put
Stores a key-value pair in this multimap.Some multimap implementations allow duplicate key-value pairs, in which case
putalways adds a new key-value pair and increases the multimap size by 1. Other implementations prohibit duplicates, and storing a key-value pair that's already in the multimap has no effect.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif the method increased the size of the multimap, orfalseif the multimap already contained the key-value pair and doesn't allow duplicates
-
remove
Removes a single key-value pair with the keykeyand the valuevaluefrom this multimap, if such exists. If multiple key-value pairs in the multimap fit this description, which one is removed is unspecified.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif the multimap changed
-
putAll
Stores a key-value pair in this multimap for each ofvalues, all using the same key,key. Equivalent to (but expected to be more efficient than):for (V value : values) { put(key, value); }In particular, this is a no-op if
valuesis empty.- Parameters:
key- - map keyvalues- - map values- Returns:
trueif the multimap changed
-
replaceValues
Stores a collection of values with the same key, replacing any existing values for that key.If
valuesis empty, this is equivalent toremoveAll(key).- Parameters:
key- - map keyvalues- - map values- Returns:
- the collection of replaced values, or an empty collection if no values were previously associated with the key. The collection may be modifiable, but updating it will have no effect on the multimap.
-
removeAll
Removes all values associated with the keykey.Once this method returns,
keywill not be mapped to any valuesUse
fastRemove(K...)if values are not needed.- Parameters:
key- - map key- Returns:
- the values that were removed (possibly empty). The returned collection may be modifiable, but updating it will have no effect on the multimap.
-
clear
void clear()Removes all key-value pairs from the multimap, leaving it empty. -
get
Returns a view collection of the values associated withkeyin this multimap, if any. Note that whencontainsKey(key)is false, this returns an empty collection, notnull.Changes to the returned collection will update the underlying multimap, and vice versa.
- Parameters:
key- - map key- Returns:
- collection of values
-
getAll
Returns all elements at once. Result collection is NOT backed by map, so changes are not reflected in map.- Parameters:
key- - map key- Returns:
- collection of values
-
keySet
Returns a view collection of all distinct keys contained in this multimap. Note that the key set contains a key if and only if this multimap maps that key to at least one value.Changes to the returned set will update the underlying multimap, and vice versa. However, adding to the returned set is not possible.
- Returns:
- set of keys
-
keySize
int keySize()Returns the count of distinct keys in this multimap.- Returns:
- keys amount
-
values
Collection<V> values()Returns a view collection containing the value from each key-value pair contained in this multimap, without collapsing duplicates (sovalues().size() == size()).Changes to the returned collection will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
- Returns:
- collection of values
-
entries
Collection<Map.Entry<K,V>> entries()Returns a view collection of all key-value pairs contained in this multimap, asMap.Entryinstances.Changes to the returned collection or the entries it contains will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
- Returns:
- collection of entries
-
fastRemove
Removeskeysfrom map by one operation Works faster thanRMultimap.removebut not returning the value associated withkey- Parameters:
keys- - map keys- Returns:
- the number of keys that were removed from the hash, not including specified but non existing keys
-
fastRemoveValue
Removesvaluesfrom map by one operation- Parameters:
values- map values- Returns:
- the number of values that were removed from the map
-
readAllKeySet
Read all keys at once- Returns:
- keys
-