Interface RSetMultimap<K,V>

Type Parameters:
K - key
V - 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 Details

    • get

      RSet<V> get(K key)
      Returns a view collection of the values associated with key in this multimap, if any. Note that when containsKey(key) is false, this returns an empty collection, not null.

      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 a Set, instead of the Collection specified in the RMultimap interface.

      Specified by:
      get in interface RMultimap<K,V>
      Parameters:
      key - - map key
      Returns:
      collection of values
    • 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 a Set, instead of the Collection specified in the RMultimap interface.

      Specified by:
      getAll in interface RMultimap<K,V>
      Parameters:
      key - - map key
      Returns:
      collection of values
    • removeAll

      Set<V> removeAll(Object key)
      Removes all values associated with the key key.

      Once this method returns, key will not be mapped to any values

      Use RMultimap.fastRemove(K...) if values are not needed.

      Because a RSetMultiMap has unique values for a given key, this method returns a Set, instead of the Collection specified in the RMultimap interface.

      Specified by:
      removeAll in interface RMultimap<K,V>
      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.
    • 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 to removeAll(key).

      Because a RSetMultiMap has unique values for a given key, this method returns a Set, instead of the Collection specified in the RMultimap interface.

      Any duplicates in values will be stored in the multimap once.

      Specified by:
      replaceValues in interface RMultimap<K,V>
      Parameters:
      key - - map key
      values - - 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, as Map.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 a Set, instead of the Collection specified in the RMultimap interface.

      Specified by:
      entries in interface RMultimap<K,V>
      Returns:
      collection of entries