Example usage for java.util.function LongFunction apply

List of usage examples for java.util.function LongFunction apply

Introduction

In this page you can find the example usage for java.util.function LongFunction apply.

Prototype

R apply(long value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjDoubleConsumer.java

/**
 * Returns a composed {@link TriLongConsumer} that first applies the {@code before} functions to
 * its input, and then applies this consumer to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 * This method is just convenience, to provide the ability to execute an operation which accepts {@code long} input,
 * before this primitive consumer is executed.
 *
 * @param before1 The first function to apply before this consumer is applied
 * @param before2 The second function to apply before this consumer is applied
 * @param before3 The third function to apply before this consumer is applied
 * @return A composed {@code TriLongConsumer} that first applies the {@code before} functions to its input, and then
 * applies this consumer to the result./*from ww w.  j  a  v a 2 s.c o m*/
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to handle primitive values. In this case this is {@code
 * long}.
 */
@Nonnull
default TriLongConsumer composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongFunction<? extends U> before2, @Nonnull final LongToDoubleFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsDouble(value3));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjLongToLongFunction.java

/**
 * Returns a composed {@link BiObjLongFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjLongFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *//*  w  w w . j  a v a 2 s.  c o m*/
@Nonnull
default <S> BiObjLongFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjBooleanToLongFunction.java

/**
 * Returns a composed {@link BiObjBooleanFunction} that first applies this function to its input, and then applies
 * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjBooleanFunction} that first applies this function to its input, and then applies
 * the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *//*from  ww w.j  a v a 2  s.  c  o m*/
@Nonnull
default <S> BiObjBooleanFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjByteToLongFunction.java

/**
 * Returns a composed {@link BiObjByteFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjByteFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 */// w w  w. jav  a2s.c  om
@Nonnull
default <S> BiObjByteFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjCharToLongFunction.java

/**
 * Returns a composed {@link BiObjCharFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjCharFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *///from ww w  .j a  v  a2  s  .c o  m
@Nonnull
default <S> BiObjCharFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjFloatToLongFunction.java

/**
 * Returns a composed {@link BiObjFloatFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjFloatFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *///from ww w.  j  av a2 s . co m
@Nonnull
default <S> BiObjFloatFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjShortToLongFunction.java

/**
 * Returns a composed {@link BiObjShortFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjShortFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *//*from www . java2 s  .com*/
@Nonnull
default <S> BiObjShortFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjIntToLongFunction.java

/**
 * Returns a composed {@link BiObjIntFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjIntFunction} that first applies this function to its input, and then applies the
 * {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *///from www  .  ja  v  a2s. c  o  m
@Nonnull
default <S> BiObjIntFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjDoubleToLongFunction.java

/**
 * Returns a composed {@link BiObjDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} function to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation.
 *
 * @param <S> The type of return value from the {@code after} function, and of the composed function
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiObjDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to return every type.
 *//*from  w w w.  j  a  v  a2 s  .  co  m*/
@Nonnull
default <S> BiObjDoubleFunction<T, U, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsLong(t, u, value));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanToByteFunction.java

/**
 * Returns a composed {@link BiLongToByteFunction} that first applies the {@code before} functions to
 * its input, and then applies this function to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 * This method is just convenience, to provide the ability to execute an operation which accepts {@code long} input,
 * before this primitive function is executed.
 *
 * @param before1 The first function to apply before this function is applied
 * @param before2 The second predicate to apply before this function is applied
 * @return A composed {@code BiLongToByteFunction} that first applies the {@code before} functions to its input, and
 * then applies this function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to handle primitive values. In this case this is {@code
 * long}./*from w w w.  ja va 2  s  .  com*/
 */
@Nonnull
default BiLongToByteFunction composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> applyAsByte(before1.apply(value1), before2.test(value2));
}