Class PartitionMap<V>

  • Type Parameters:
    V - the type of values
    All Implemented Interfaces:
    java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>

    public class PartitionMap<V>
    extends java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
    A map that uses a pair of spec ID and partition tuple as keys.

    This implementation internally stores provided partition tuples in StructLikeMap for consistent hashing and equals behavior. This ensures that objects of different types that represent the same structs are treated as equal keys in the map.

    Note: This map is not designed for concurrent modification by multiple threads. However, it supports safe concurrent reads, assuming there are no concurrent writes.

    Note: This map does not support null pairs but supports null as partition tuples.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        size in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        isEmpty in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        containsKey in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • containsKey

        public boolean containsKey​(int specId,
                                   StructLike struct)
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        containsValue in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        get in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • get

        public V get​(int specId,
                     StructLike struct)
      • put

        public V put​(Pair<java.lang.Integer,​StructLike> key,
                     V value)
        Specified by:
        put in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        put in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • put

        public V put​(int specId,
                     StructLike struct,
                     V value)
      • putAll

        public void putAll​(java.util.Map<? extends Pair<java.lang.Integer,​StructLike>,​? extends V> otherMap)
        Specified by:
        putAll in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        putAll in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        remove in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • removeKey

        public V removeKey​(int specId,
                           StructLike struct)
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        clear in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • keySet

        public java.util.Set<Pair<java.lang.Integer,​StructLike>> keySet()
        Specified by:
        keySet in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        keySet in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • values

        public java.util.Collection<V> values()
        Specified by:
        values in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Overrides:
        values in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<Pair<java.lang.Integer,​StructLike>,​V>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<Pair<java.lang.Integer,​StructLike>,​V>
        Specified by:
        entrySet in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>
      • computeIfAbsent

        public V computeIfAbsent​(int specId,
                                 StructLike struct,
                                 java.util.function.Supplier<V> valueSupplier)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractMap<Pair<java.lang.Integer,​StructLike>,​V>