Example usage for java.util.function LongToIntFunction applyAsInt

List of usage examples for java.util.function LongToIntFunction applyAsInt

Introduction

In this page you can find the example usage for java.util.function LongToIntFunction applyAsInt.

Prototype

int applyAsInt(long value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:at.gridtec.lambda4j.function.bi.to.ToLongBiFunction2.java

/**
 * Returns a composed {@link ToIntBiFunction2} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code ToIntBiFunction2} 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 a able to return primitive values. In this case this is {@code
 * int}.//from  www.  j a  v a 2  s . c om
 */
@Nonnull
default ToIntBiFunction2<T, U> andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (t, u) -> after.applyAsInt(applyAsLong(t, u));
}

From source file:at.gridtec.lambda4j.function.tri.to.ToLongTriFunction.java

/**
 * Returns a composed {@link ToIntTriFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code ToIntTriFunction} 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 a able to return primitive values. In this case this is {@code
 * int}.//from ww w  . j a va  2s.com
 */
@Nonnull
default ToIntTriFunction<T, U, V> andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (t, u, v) -> after.applyAsInt(applyAsLong(t, u, v));
}

From source file:at.gridtec.lambda4j.function.bi.BiIntFunction.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  v  a2s  .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 LongToIntFunction before1,
        @Nonnull final LongToIntFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.applyAsInt(value1), before2.applyAsInt(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.//  w w  w.j a va 2s  .  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 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.conversion.BiBooleanToLongFunction.java

/**
 * Returns a composed {@link BiBooleanToIntFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiBooleanToIntFunction} 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 a able to return primitive values. In this case this is {@code
 * int}.//w  ww . j  a  v  a  2 s  .c o  m
 */
@Nonnull
default BiBooleanToIntFunction andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToLongFunction.java

/**
 * Returns a composed {@link BiByteToIntFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiByteToIntFunction} 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 a able to return primitive values. In this case this is {@code
 * int}./*from  w w w . j a  va 2s.  c  o  m*/
 */
@Nonnull
default BiByteToIntFunction andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToLongFunction.java

/**
 * Returns a composed {@link BiCharToIntFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiCharToIntFunction} 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 a able to return primitive values. In this case this is {@code
 * int}./*from  www  .  j a v a2 s  .c o  m*/
 */
@Nonnull
default BiCharToIntFunction andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiFloatToLongFunction.java

/**
 * Returns a composed {@link BiFloatToIntFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiFloatToIntFunction} 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 a able to return primitive values. In this case this is {@code
 * int}./*from w w w.  ja  v  a 2 s. c o m*/
 */
@Nonnull
default BiFloatToIntFunction andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiShortToLongFunction.java

/**
 * Returns a composed {@link BiShortToIntFunction} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code BiShortToIntFunction} 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 a able to return primitive values. In this case this is {@code
 * int}./*www .jav a 2s.  c  o m*/
 */
@Nonnull
default BiShortToIntFunction andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiIntToLongFunction.java

/**
 * Returns a composed {@link IntBinaryOperator2} 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. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code int}.
 *
 * @param after The function to apply after this function is applied
 * @return A composed {@code IntBinaryOperator2} 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 a able to return primitive values. In this case this is {@code
 * int}.//from w w  w. ja  v a  2s.  c  o  m
 */
@Nonnull
default IntBinaryOperator2 andThenToInt(@Nonnull final LongToIntFunction after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsInt(applyAsLong(value1, value2));
}