Interface LongFunction<R>

Type Parameters:
R - the type of the result of the function
All Superinterfaces:
Function<Long,​R>, Function<Long,​R>, LongFunction<R>
All Known Subinterfaces:
LongPredicate, LongToDoubleFunction, LongToIntFunction, LongUnaryOperator
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 LongFunction<R>
extends Function<Long,​R>, LongFunction<R>
Represents a function that accepts a long-valued argument and produces a result. This is the long-consuming primitive specialization for Function.

This is a functional interface whose functional method is apply(long).

Since:
1.8
See Also:
Function
  • Field Details

  • Method Details

    • apply

      R apply​(long value)
      Applies this function to the given argument.
      Specified by:
      apply in interface LongFunction<R>
      Parameters:
      value - the function argument
      Returns:
      the function result
    • apply

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

      default Supplier<R> applyPartial​(long t)
      Partially apply a parameter such that a single param function becomes a no-param supplier.
      Parameters:
      t - The parameter to apply.
      Returns:
      A partially-applied function.
    • consume

      default LongConsumer consume​(Consumer<R> consumer)
      Consume a function.
      Specified by:
      consume in interface Function<Long,​R>
      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.
    • mapToPredicate

      default LongPredicate mapToPredicate​(Predicate<? super R> functor)
      Lift a function.
      Specified by:
      mapToPredicate in interface Function<Long,​R>
      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.
    • map

      default <S> LongFunction<S> map​(Function<? super R,​? extends S> functor)
      Lift a function.
      Specified by:
      map in interface Function<Long,​R>
      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.
    • mapToLong

      default LongUnaryOperator mapToLong​(ToLongFunction<? super R> functor)
      Lift a function.
      Specified by:
      mapToLong in interface Function<Long,​R>
      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.
    • mapToInt

      default LongToIntFunction mapToInt​(ToIntFunction<? super R> functor)
      Lift a function.
      Specified by:
      mapToInt in interface Function<Long,​R>
      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 LongToDoubleFunction mapToDouble​(ToDoubleFunction<? super R> functor)
      Lift a function.
      Specified by:
      mapToDouble in interface Function<Long,​R>
      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.
    • identity

      static LongUnaryOperator identity()
      Returns a unary operator that always returns its input argument.
      Returns:
      a unary operator that always returns its input argument