Class Relation<K,V>

java.lang.Object
com.ibm.icu.impl.Relation<K,V>
All Implemented Interfaces:
Freezable<Relation<K,V>>, Cloneable

public class Relation<K,V> extends Object implements Freezable<Relation<K,V>>
A Relation is a set of mappings from keys to values. Unlike Map, there is not guaranteed to be a single value per key. The Map-like APIs return collections for values.
  • Field Details

    • data

      private Map<K,Set<V>> data
    • setCreator

      Constructor<? extends Set<V>> setCreator
    • setComparatorParam

      Object[] setComparatorParam
    • frozen

      volatile boolean frozen
  • Constructor Details

  • Method Details

    • of

      public static <K, V> Relation<K,V> of(Map<K,Set<V>> map, Class<?> setCreator)
    • of

      public static <K, V> Relation<K,V> of(Map<K,Set<V>> map, Class<?> setCreator, Comparator<V> setComparator)
    • clear

      public void clear()
    • containsKey

      public boolean containsKey(Object key)
    • containsValue

      public boolean containsValue(Object value)
    • entrySet

      public final Set<Map.Entry<K,V>> entrySet()
    • keyValuesSet

      public Set<Map.Entry<K,Set<V>>> keyValuesSet()
    • keyValueSet

      public Set<Map.Entry<K,V>> keyValueSet()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getAll

      public Set<V> getAll(Object key)
    • get

      public Set<V> get(Object key)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isEmpty

      public boolean isEmpty()
    • keySet

      public Set<K> keySet()
    • put

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

      public V putAll(K key, Collection<? extends V> values)
    • putAll

      public V putAll(Collection<K> keys, V value)
    • newSet

      private Set<V> newSet()
    • putAll

      public void putAll(Map<? extends K,? extends V> t)
    • putAll

      public void putAll(Relation<? extends K,? extends V> t)
    • removeAll

      public Set<V> removeAll(K key)
    • remove

      public boolean remove(K key, V value)
    • size

      public int size()
    • values

      public Set<V> values()
    • values

      public <C extends Collection<V>> C values(C result)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addAllInverted

      public Relation<K,V> addAllInverted(Relation<V,K> source)
    • addAllInverted

      public Relation<K,V> addAllInverted(Map<V,K> source)
    • isFrozen

      public boolean isFrozen()
      Description copied from interface: Freezable
      Determines whether the object has been frozen or not.
      Specified by:
      isFrozen in interface Freezable<K>
    • freeze

      public Relation<K,V> freeze()
      Description copied from interface: Freezable
      Freezes the object.
      Specified by:
      freeze in interface Freezable<K>
      Returns:
      the object itself.
    • cloneAsThawed

      public Relation<K,V> cloneAsThawed()
      Description copied from interface: Freezable
      Provides for the clone operation. Any clone is initially unfrozen.
      Specified by:
      cloneAsThawed in interface Freezable<K>
    • removeAll

      public boolean removeAll(Relation<K,V> toBeRemoved)
    • removeAll

      @SafeVarargs public final Set<V> removeAll(K... keys)
    • removeAll

      public boolean removeAll(K key, Iterable<V> toBeRemoved)
    • removeAll

      public Set<V> removeAll(Collection<K> toBeRemoved)