Class MapMapTwoKeyMap<K1,K2,V>

java.lang.Object
pascal.taie.util.collection.AbstractTwoKeyMap<K1,K2,V>
pascal.taie.util.collection.MapMapTwoKeyMap<K1,K2,V>
All Implemented Interfaces:
Serializable, TwoKeyMap<K1,K2,V>

public class MapMapTwoKeyMap<K1,K2,V> extends AbstractTwoKeyMap<K1,K2,V> implements Serializable
Implements TwoKeyMap as map of maps.
See Also:
  • Constructor Details

  • Method Details

    • get

      @Nullable public Map<K2,V> get(K1 key1)
      Specified by:
      get in interface TwoKeyMap<K1,K2,V>
      Returns:
      an unmodifiable view of the second-level map for key1, or null if this map contains no mapping for the key.
    • put

      @Nullable public V put(@Nonnull K1 key1, @Nonnull K2 key2, @Nonnull V value)
      Description copied from interface: TwoKeyMap
      Associates the specified value with the specified two-key pair in this map. If the map previously contained a mapping for the keys, the old value is replaced by the specified value.
      Specified by:
      put in interface TwoKeyMap<K1,K2,V>
      Returns:
      the previous value associated with key1 and key2, or null if there was no mapping for key2.
    • putAll

      public void putAll(@Nonnull K1 key1, @Nonnull Map<K2,V> map)
      Description copied from interface: TwoKeyMap
      Copies all the mappings from the specified map to second-level map associated with key1.
      Specified by:
      putAll in interface TwoKeyMap<K1,K2,V>
    • putAll

      public void putAll(@Nonnull TwoKeyMap<K1,K2,V> twoKeyMap)
      Description copied from interface: TwoKeyMap
      Copies all the mappings from the specified two-key map to this map.
      Specified by:
      putAll in interface TwoKeyMap<K1,K2,V>
    • remove

      @Nullable public V remove(K1 key1, K2 key2)
      Description copied from interface: TwoKeyMap
      Removes the mapping for a key-pair from this map if it is present.
      Specified by:
      remove in interface TwoKeyMap<K1,K2,V>
      Returns:
      the value to which this map previously associated the key pair, or null if the map contained no mapping for the key pair.
    • removeAll

      public boolean removeAll(K1 key1)
      Description copied from interface: TwoKeyMap
      Removes all mappings with key1 as the first key in this map.
      Specified by:
      removeAll in interface TwoKeyMap<K1,K2,V>
      Returns:
      true if the two-key map changed.
    • replaceALl

      public void replaceALl(TriFunction<? super K1,? super K2,? super V,? extends V> function)
      Description copied from interface: TwoKeyMap
      Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
      Specified by:
      replaceALl in interface TwoKeyMap<K1,K2,V>
    • keySet

      public Set<K1> keySet()
      Specified by:
      keySet in interface TwoKeyMap<K1,K2,V>
      Returns:
      an unmodifiable view of first keys of all mappings contained in this two-key map. Note that the result contains a key if and only if this map contains at least one mapping with the key as the first key.
    • entryIterator

      protected Iterator<TwoKeyMap.Entry<K1,K2,V>> entryIterator()
      Specified by:
      entryIterator in class AbstractTwoKeyMap<K1,K2,V>
    • clear

      public void clear()
      Description copied from interface: TwoKeyMap
      Removes all the mappings from this map. The map will be empty after this call returns.
      Specified by:
      clear in interface TwoKeyMap<K1,K2,V>
    • size

      public int size()
      Specified by:
      size in interface TwoKeyMap<K1,K2,V>
      Returns:
      the number of key1-key2-value mappings in this map.