Interface IntMap<E>


@Internal public interface IntMap<E>
A read-only map where the keys are non-negative integers.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <E extends Enum<?>>
    IntMap<E>
    from(Class<E> enumClass, Function<E,Integer> keyExtractor)
    Returns a new instance where the values are the values of the given enum class, and the associated key is derived by applying the given function to the value.
    static <E> IntMap<E>
    from(Iterable<E> items, Function<E,Integer> keyExtractor)
    Returns a new instance where the values are the values of the given iterable, and the associated key is derived by applying the given function to the value.
    static <E> IntMap<E>
    from(Map<Integer,E> map)
    Returns a new instance from the entries of the given map.
    default E
    get(byte key)
    Reinterprets the byte as a positive integer, then returns the value associated with the given integer, or null if not found.
    get(int key)
    Returns the value associated with the given integer, or null if not found.
    default E
    get(short key)
    Reinterprets the short as a positive integer, then returns the value associated with the given integer, or null if not found.
  • Method Details

    • get

      @Nullable E get(int key)
      Returns the value associated with the given integer, or null if not found.
      Parameters:
      key - the non-negative integer associated with the value to return
      Throws:
      IllegalArgumentException - if the given key is negative.
    • get

      @Nullable default E get(short key)
      Reinterprets the short as a positive integer, then returns the value associated with the given integer, or null if not found.
      Parameters:
      key - the short associated with the value to return
    • get

      @Nullable default E get(byte key)
      Reinterprets the byte as a positive integer, then returns the value associated with the given integer, or null if not found.
      Parameters:
      key - the byte associated with the value to return
    • from

      static <E extends Enum<?>> IntMap<E> from(Class<E> enumClass, Function<E,Integer> keyExtractor)
      Returns a new instance where the values are the values of the given enum class, and the associated key is derived by applying the given function to the value.
      Throws:
      IllegalArgumentException - if a derived key is negative, null, or not unique
    • from

      static <E> IntMap<E> from(Iterable<E> items, Function<E,Integer> keyExtractor)
      Returns a new instance where the values are the values of the given iterable, and the associated key is derived by applying the given function to the value.
      Throws:
      IllegalArgumentException - if a derived key is negative, null, or not unique
    • from

      static <E> IntMap<E> from(Map<Integer,E> map)
      Returns a new instance from the entries of the given map.
      Throws:
      IllegalArgumentException - if the map contains a key that is null or negative.