Class Multimap<K,V>

java.lang.Object
ch.tocco.nice2.persist.entity.spi.template.Multimap<K,V>
All Implemented Interfaces:
Serializable

public class Multimap<K,V> extends Object implements Serializable
A simple multimap implemenation that is serializable, i.e. with xstream.
See Also:
  • Constructor Details

    • Multimap

      public Multimap()
  • Method Details

    • create

      public static <K, V> Multimap<K,V> create()
    • getMap

      public Map<K,LinkedHashSet<V>> getMap()
    • setMap

      public void setMap(Map<K,LinkedHashSet<V>> map)
    • put

      public void put(K key, V value)
    • putAll

      public void putAll(K key, Iterable<V> values)
    • putAll

      public void putAll(Multimap<K,V> other)
    • remove

      public void remove(K key, V value)
    • removeAll

      public void removeAll(K key)
    • get

      public Set<V> get(K key)
    • keySet

      public Set<K> keySet()
    • mapValues

      public <X> Multimap<K,X> mapValues(Function<V,X> fun)
    • mapKeys

      public <K2> Multimap<K2,V> mapKeys(Function<K,K2> fun)
      Transforms this map into a new one applying each key of this to the given function.
    • transform

      public <K2, V2> Multimap<K2,V2> transform(Function<Tuple2<K,Collection<V>>,Tuple2<K2,Iterable<V2>>> fun)
      Transforms this map to a new map using the given function. The function receives each key → collection pair. Please note, although the collection handed into the function is not mutable.