Class OneToManyHashBiMap<K,​V>

    • Constructor Detail

      • OneToManyHashBiMap

        public OneToManyHashBiMap()
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface Map<K,​V>
      • containsKey

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<K,​V>
      • containsSingleValue

        public boolean containsSingleValue​(V value)
        Description copied from interface: OneToManyMap
        This method returns true if any of the value sets in the OneToManyMap contains an equivalent object to the value parameter, where equivalence is determined using the equals(Object) method.
        Specified by:
        containsSingleValue in interface OneToManyMap<K,​V>
        Parameters:
        value - The value being searched for.
        Returns:
        Returns true if any of the value sets contains a matching value, otherwise returns false
      • entries

        public Set<Map.Entry<K,​V>> entries()
        Description copied from interface: OneToManyMap
        This method is similar to the java.util.Map.entrySet() method, however the entries returned map from a key to a value, rather than from a key(K) to a value(V) rather than froma key(K) to a set of values(Set<V>).
        Note that the entries returned by this method do not support the method java.util.Map.Entry.setValue(V).
        Specified by:
        entries in interface OneToManyMap<K,​V>
        Returns:
        The Set<Entry<K, V>> representing all the key-value pairs in the ManyToOneMap.
      • getKey

        public K getKey​(V value)
        Description copied from interface: OneToManyBiMap
        Returns the key, if any, for the specified value. If the specified value does not exist within the map then this method returns null.
        Specified by:
        getKey in interface OneToManyBiMap<K,​V>
        Returns:
        The key to the specified value or null.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<K,​V>
      • keySet

        public Set<K> keySet()
        Specified by:
        keySet in interface Map<K,​V>
      • put

        public Set<V> put​(K key,
                          Set<V> values)
        Specified by:
        put in interface Map<K,​V>
      • putSingleValue

        public V putSingleValue​(K key,
                                V value)
        Description copied from interface: OneToManyMap
        This method is similar to the method java.util.Map.put(K, V) , however it allows the user to add a single value to the map rather than adding a java.util.Set containing one or more values. If the specified key already has a set of values associated with it then the new value is added to this set. Otherwise a new set is created and the new value is added to that.
        Specified by:
        putSingleValue in interface OneToManyMap<K,​V>
        Returns:
        returns the newly added value.
      • putAll

        public void putAll​(Map<? extends K,​? extends Set<V>> m)
        Specified by:
        putAll in interface Map<K,​V>
      • putAllSingleValues

        public void putAllSingleValues​(Map<? extends K,​? extends V> m)
        Description copied from interface: OneToManyMap
        This method is similar to java.utilMap.putAll(Map m), however the map specified is from keys to values instead of keys to sets of values.
        Specified by:
        putAllSingleValues in interface OneToManyMap<K,​V>
        Parameters:
        m - A map containing the key-value mappings to be added to the ManyToOneMap.
      • removeValue

        public K removeValue​(V value)
        Description copied from interface: OneToManyBiMap
        Removes the specified value from the OneToManyBiMap. If this was the only value associated with the key to this value, then the key is also removed.
        Specified by:
        removeValue in interface OneToManyBiMap<K,​V>
        Parameters:
        value - The value to be removed.
        Returns:
        The key that is associated with the value to be removed.
      • size

        public int size()
        Specified by:
        size in interface Map<K,​V>
      • flatValues

        public Collection<V> flatValues()
        Description copied from interface: OneToManyMap
        Returns a Collection of all the values in the map. Unlike values() the values are in a single flattened Collection<V> rather than a Collection<Set<V>>.
        Specified by:
        flatValues in interface OneToManyMap<K,​V>
        Returns:
        All the values in the map as a flattened Collection.