- 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.
Defines an interface for conveniently accessing objects by integer indices. This interface
can be used to implement functionality that maps an integer to an object. 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 TypeMethodDescriptiondefault <T> Tget(int i) 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
-