Class IntIndexHashMap<V>

    • Constructor Detail

      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer,
                               Equaller<? super V> valueEqualler,
                               int initialCapacity,
                               float loadFactor)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
        valueEqualler - the value equaller
        initialCapacity - the initial capacity
        loadFactor - the load factor
      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer,
                               Equaller<? super V> valueEqualler)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
        valueEqualler - the value equaller
      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer,
                               int initialCapacity,
                               float loadFactor)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
        initialCapacity - the initial capacity
        loadFactor - the load factor
      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer,
                               float loadFactor)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
        loadFactor - the load factor
      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer,
                               int initialCapacity)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
        initialCapacity - the initial capacity
      • IntIndexHashMap

        public IntIndexHashMap​(ToIntFunction<? super V> indexer)
        Construct a new instance.
        Parameters:
        indexer - the key indexer
    • Method Detail

      • putIfAbsent

        public V putIfAbsent​(V value)
        Description copied from interface: IntIndexMap
        Put a value into the map if there is not already an existing mapping for it.
        Specified by:
        putIfAbsent in interface IntIndexMap<V>
        Parameters:
        value - the value to add
        Returns:
        the existing value, if any, or null if the existing value was null or the value was added successfully
      • computeIfAbsent

        public V computeIfAbsent​(int index,
                                 IntFunction<V> producer)
        Description copied from interface: IntIndexMap
        Compute a map value if no mapping exists.
        Specified by:
        computeIfAbsent in interface IntIndexMap<V>
        Parameters:
        index - the key
        producer - the producer which creates a new value
        Returns:
        the existing or new value
      • removeKey

        public V removeKey​(int index)
        Description copied from interface: IntIndexMap
        Remove and return a value for the given index.
        Specified by:
        removeKey in interface IntIndexMap<V>
        Parameters:
        index - the index
        Returns:
        the value
      • containsKey

        public boolean containsKey​(int index)
        Description copied from interface: IntIndexMap
        Determine whether the given index is contained in the map.
        Specified by:
        containsKey in interface IntIndexMap<V>
        Parameters:
        index - the index
        Returns:
        true if it is contained in the map
      • get

        public V get​(int index)
        Description copied from interface: IntIndexMap
        Get the value for the given index.
        Specified by:
        get in interface IntIndexMap<V>
        Parameters:
        index - the index
        Returns:
        the corresponding value
      • put

        public V put​(V value)
        Description copied from interface: IntIndexMap
        Put a value into the map, replacing and returning any existing mapping.
        Specified by:
        put in interface IntIndexMap<V>
        Parameters:
        value - the value to add
        Returns:
        the old value, or null if the old value was null or was not present
      • replace

        public V replace​(V value)
        Description copied from interface: IntIndexMap
        Put a value into the map only if there is an existing mapping for it.
        Specified by:
        replace in interface IntIndexMap<V>
        Parameters:
        value - the value to store
        Returns:
        the previous value (may be null) or null if there was no mapping to replace
      • replace

        public boolean replace​(V oldValue,
                               V newValue)
        Description copied from interface: IntIndexMap
        Replace an old value with a new value.
        Specified by:
        replace in interface IntIndexMap<V>
        Parameters:
        oldValue - the value to replace
        newValue - the value to replace with
        Returns:
        true if the replacement succeeded, or false if the old value was not present in the map