Interface RListMultimap<K,V>

Type Parameters:
K - key
V - value
All Superinterfaces:
RExpirable, RExpirableAsync, RMultimap<K,V>, RMultimapAsync<K,V>, RObject, RObjectAsync
All Known Subinterfaces:
RListMultimapCache<K,V>
All Known Implementing Classes:
RedissonListMultimap, RedissonListMultimapCache

public interface RListMultimap<K,V> extends RMultimap<K,V>
List based Multimap. Stores insertion order and allows duplicates for values mapped to key.
Author:
Nikita Koksharov
  • Method Details

    • get

      RList<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 RListMultimap may has duplicates among values mapped by key and stores insertion order method returns a List, 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

      List<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 RListMultimap may has duplicates among values mapped by key and stores insertion order method returns a List, 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

      List<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 RListMultimap may has duplicates among values mapped by key and stores insertion order method returns a List, 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

      List<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 RListMultimap may has duplicates among values mapped by key and stores insertion order method returns a List, instead of the Collection specified in the RMultimap interface.

      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.