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.function.bi.obj.ObjBooleanFunction.java

/**
 * Returns a composed {@link BiLongFunction} 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 BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from w ww.  j  a v a  2s  .  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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.test(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from w w 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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToByteFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsByte(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from  www  .  j a  v a  2 s. co  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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToCharFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsChar(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from  w  w  w. j  a v  a 2  s .  co 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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToIntFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsInt(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 operator to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//from   w ww  .j  av a2  s. co  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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongUnaryOperator before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsLong(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//www .j ava2 s  .c om
 * @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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToFloatFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsFloat(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//from   w ww. j  a va  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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToShortFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsShort(value2));
}

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

/**
 * Returns a composed {@link BiLongFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiLongFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//w  w w  .  j  a  v a 2s  .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 BiLongFunction<R> composeFromLong(@Nonnull final LongFunction<? extends T> before1,
        @Nonnull final LongToDoubleFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsDouble(value2));
}

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

/**
 * Returns a composed {@link ObjLongFunction} 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 ObjLongFunction} 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 .java  2 s. c o  m*/
@Nonnull
default <S> ObjLongFunction<T, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value) -> after.apply(applyAsLong(t, value));
}

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

/**
 * Returns a composed {@link ObjByteFunction} 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 ObjByteFunction} 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 va 2 s.  c  om*/
@Nonnull
default <S> ObjByteFunction<T, S> andThen(@Nonnull final LongFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value) -> after.apply(applyAsLong(t, value));
}