Interface ToIntFunction<T>

Type Parameters:
T - the type of the input to the function
All Superinterfaces:
Function<T,​Integer>, Function<T,​Integer>, ToIntFunction<T>
All Known Subinterfaces:
DoubleToIntFunction, IntUnaryOperator, LongToIntFunction
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 ToIntFunction<T>
extends Function<T,​Integer>, ToIntFunction<T>
Represents a function that produces an int-valued result. This is the int-producing primitive specialization for Function.

This is a functional interface whose functional method is applyAsInt(Object).

Since:
1.8
See Also:
Function
  • Field Details

  • Method Details

    • applyAsInt

      int applyAsInt​(T value)
      Applies this function to the given argument.
      Specified by:
      applyAsInt in interface ToIntFunction<T>
      Parameters:
      value - the function argument
      Returns:
      the function result
    • apply

      default Integer apply​(T t)
      Applies this function to the given argument.
      Specified by:
      apply in interface Function<T,​Integer>
      Specified by:
      apply in interface Function<T,​Integer>
      Parameters:
      t - the function argument
      Returns:
      the function result
    • applyPartial

      default IntSupplier applyPartial​(T t)
      Partially apply a parameter such that a single param function becomes a no-param supplier.
      Specified by:
      applyPartial in interface Function<T,​Integer>
      Parameters:
      t - The parameter to apply.
      Returns:
      A partially-applied function.
    • consume

      default Consumer<T> consume​(IntConsumer consumer)
      Consume a function.
      Parameters:
      consumer - The consumer to use in consuming.
      Returns:
      A Consumer which passes it's argument to this function and then passes the result into the given consumer.
    • map

      default ToIntFunction<T> map​(IntUnaryOperator functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToObj

      default <S> Function<T,​S> mapToObj​(IntFunction<? extends S> functor)
      Lift a function.
      Type Parameters:
      S - The return type.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToPredicate

      default Predicate<T> mapToPredicate​(IntPredicate functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToDouble

      default ToDoubleFunction<T> mapToDouble​(IntToDoubleFunction functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToLong

      default ToLongFunction<T> mapToLong​(IntToLongFunction functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.