Interface IntMap<V>

  • All Known Implementing Classes:
    IntHashMap, IntRWHashMap

    public interface IntMap<V>
    The map for integer keys.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  IntMap.EntryConsumer<V,​E extends Throwable>
      The bridge for consuming all entries of the map.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void clear()
      Removes all of the mappings from this map.
      default V computeIfAbsent​(int key, IntFunction<? extends V> mappingFunction)
      If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.
      boolean containsKey​(int key)
      Returns true if the map contains the key, otherwise false.
      boolean containsValue​(V val)
      Returns true if the map contains one or more values, otherwise false.
      <E extends Throwable>
      void
      forEach​(IntMap.EntryConsumer<V,​E> act)
      This method work under a read lock, be careful with long operations inside.
      V get​(int key)
      Returns value associated with the key. if the map doesn't contain the key, returns null.
      boolean isEmpty()
      Returns true if this map contains no key-value mappings.
      int[] keys()
      Returns array of keys.
      V put​(int key, V val)
      Save the pair into the map.
      V putIfAbsent​(int key, V val)
      Does put into the map if a pair isn't present, otherwise returns stored value.
      V remove​(int key)  
      int size()
      Returns count of elements.
      Collection<V> values()
      Returns a collection of values.
    • Method Detail

      • containsKey

        boolean containsKey​(int key)
        Returns true if the map contains the key, otherwise false.
        Parameters:
        key - tests key value.
      • containsValue

        boolean containsValue​(V val)
        Returns true if the map contains one or more values, otherwise false.
        Parameters:
        val - value to be associated with the specified key.
      • get

        V get​(int key)
        Returns value associated with the key. if the map doesn't contain the key, returns null.
        Parameters:
        key - key with which the specified value is to be associated.
      • put

        V put​(int key,
              V val)
        Save the pair into the map. If a pair is present, returns old value and store new.
        Parameters:
        key - key with which the specified value is to be associated.
        val - value to be associated with the specified key.
      • remove

        V remove​(int key)
        Parameters:
        key - key with which the specified value is to be associated.
      • putIfAbsent

        V putIfAbsent​(int key,
                      V val)
        Does put into the map if a pair isn't present, otherwise returns stored value.
        Parameters:
        key - key with which the specified value is to be associated..
        val - value to be associated with the specified key..
      • forEach

        <E extends Throwable> void forEach​(IntMap.EntryConsumer<V,​E> act)
                                    throws E extends Throwable
        This method work under a read lock, be careful with long operations inside.
        Parameters:
        act - Action.
        Throws:
        E extends Throwable
      • size

        int size()
        Returns count of elements.
      • isEmpty

        boolean isEmpty()
        Returns true if this map contains no key-value mappings.
      • keys

        int[] keys()
        Returns array of keys.
      • values

        Collection<V> values()
        Returns a collection of values.
      • clear

        void clear()
        Removes all of the mappings from this map.
      • computeIfAbsent

        @Nullable
        default V computeIfAbsent​(int key,
                                  IntFunction<? extends V> mappingFunction)
        If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.
        Parameters:
        key - Key with which the specified value is to be associated.
        mappingFunction - Function to compute a value.
        Returns:
        Current (existing or computed) value.
        Throws:
        NullPointerException - If the mappingFunction is null.