Interface RSetMultimap<K,V>
-
- Type Parameters:
K
- keyV
- value
- All Superinterfaces:
RExpirable
,RExpirableAsync
,RMultimap<K,V>
,RMultimapAsync<K,V>
,RObject
,RObjectAsync
- All Known Subinterfaces:
RSetMultimapCache<K,V>
- All Known Implementing Classes:
RedissonSetMultimap
,RedissonSetMultimapCache
public interface RSetMultimap<K,V> extends RMultimap<K,V>
Set based Multimap. Doesn't allow duplications for values mapped to key.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<Map.Entry<K,V>>
entries()
Returns a view collection of all key-value pairs contained in this multimap, asMap.Entry
instances.RSet<V>
get(K key)
Returns a view collection of the values associated withkey
in this multimap, if any.Set<V>
getAll(K key)
Returns all elements at once.Set<V>
removeAll(Object key)
Removes all values associated with the keykey
.Set<V>
replaceValues(K key, Iterable<? extends V> values)
Stores a collection of values with the same key, replacing any existing values for that key.-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RMultimap
clear, containsEntry, containsKey, containsValue, fastRemove, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, isEmpty, keySet, keySize, put, putAll, readAllKeySet, remove, size, values
-
Methods inherited from interface org.redisson.api.RMultimapAsync
containsEntryAsync, containsKeyAsync, containsValueAsync, fastRemoveAsync, getAllAsync, keySizeAsync, putAllAsync, putAsync, readAllKeySetAsync, removeAllAsync, removeAsync, replaceValuesAsync, sizeAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
get
RSet<V> get(K key)
Returns a view collection of the values associated withkey
in 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.
Because a
RSetMultiMap
has unique values for a given key, this method returns aSet
, instead of theCollection
specified in theRMultimap
interface.
-
getAll
Set<V> getAll(K key)
Returns all elements at once. Result collection is NOT backed by map, so changes are not reflected in map.Because a
RSetMultiMap
has unique values for a given key, this method returns aSet
, instead of theCollection
specified in theRMultimap
interface.
-
removeAll
Set<V> removeAll(Object key)
Removes all values associated with the keykey
.Once this method returns,
key
will not be mapped to any valuesUse
RMultimap.fastRemove(K...)
if values are not needed.Because a
RSetMultiMap
has unique values for a given key, this method returns aSet
, instead of theCollection
specified in theRMultimap
interface.
-
replaceValues
Set<V> replaceValues(K key, Iterable<? extends V> values)
Stores a collection of values with the same key, replacing any existing values for that key.If
values
is empty, this is equivalent toremoveAll(key)
.Because a
RSetMultiMap
has unique values for a given key, this method returns aSet
, instead of theCollection
specified in theRMultimap
interface.Any duplicates in
values
will be stored in the multimap once.- Specified by:
replaceValues
in interfaceRMultimap<K,V>
- 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.
-
entries
Set<Map.Entry<K,V>> entries()
Returns a view collection of all key-value pairs contained in this multimap, asMap.Entry
instances.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.
Because a
RSetMultiMap
has unique values for a given key, this method returns aSet
, instead of theCollection
specified in theRMultimap
interface.
-
-