Interface IntToValue

All Superinterfaces:
IntFunction<Object>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IntToValue extends IntFunction<Object>
Defines an interface for conveniently accessing objects by integer indices. For instance, in the context of an array of objects Object[] arr, an implementation of IntToValue could be represented as IntToValue itv = i -> arr[i];.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> T
    get(int i)
    Retrieves the value at the specified index with the expected return type.
    default <T> T
    get(int i, Class<T> ignored)
    Retrieves the value at the specified index with the expected return type.

    Methods inherited from interface java.util.function.IntFunction

    apply
  • Method Details

    • get

      default <T> T get(int i)
      Retrieves the value at the specified index with the expected return type.
      Type Parameters:
      T - the type of the value to retrieve.
      Parameters:
      i - the index of the value to retrieve
      Returns:
      the value at the specified index, cast to the declared type
    • get

      default <T> T get(int i, Class<T> ignored)
      Retrieves the value at the specified index with the expected return type.
      Type Parameters:
      T - the type of the value to retrieve.
      Parameters:
      i - the index of the value to retrieve
      ignored - the class of the value to retrieve
      Returns:
      the value at the specified index, cast to the declared type