Example usage for java.util.function ToIntFunction applyAsInt

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

Introduction

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

Prototype

int applyAsInt(T value);

Source Link

Document

Applies this function to the given argument.

Usage

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

/**
 * Returns a composed {@link ToCharBiFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @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 ToCharBiFunction} 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 able to handle every type.
 */// w ww .jav a  2s  .c  o m
@Nonnull
default <A, B> ToCharBiFunction<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsChar(before1.applyAsInt(a), before2.applyAsInt(b));
}

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

/**
 * Returns a composed {@link ToFloatBiFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @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 ToFloatBiFunction} 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 able to handle every type.
 *///from   w ww. jav a 2  s  .c o  m
@Nonnull
default <A, B> ToFloatBiFunction<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsFloat(before1.applyAsInt(a), before2.applyAsInt(b));
}

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

/**
 * Returns a composed {@link ToLongBiFunction2} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @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 ToLongBiFunction2} 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 able to handle every type.
 *///ww  w.  j ava2s .co  m
@Nonnull
default <A, B> ToLongBiFunction2<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsLong(before1.applyAsInt(a), before2.applyAsInt(b));
}

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

/**
 * Returns a composed {@link ToShortBiFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @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 ToShortBiFunction} 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 able to handle every type.
 *///from w  w  w .  j  a  va2s .  co m
@Nonnull
default <A, B> ToShortBiFunction<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsShort(before1.applyAsInt(a), before2.applyAsInt(b));
}

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

/**
 * Returns a composed {@link ToDoubleBiFunction2} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @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 ToDoubleBiFunction2} 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 able to handle every type.
 */// w  ww . j  a  va 2  s .com
@Nonnull
default <A, B> ToDoubleBiFunction2<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsDouble(before1.applyAsInt(a), before2.applyAsInt(b));
}

From source file:at.gridtec.lambda4j.function.tri.TriIntFunction.java

/**
 * Returns a composed {@link TriFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @param <C> The type of the argument to the third given function, and of composed function
 * @param before1 The first function to apply before this function is applied
 * @param before2 The second function to apply before this function is applied
 * @param before3 The third function to apply before this function is applied
 * @return A composed {@code TriFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//ww  w .  ja  va 2 s.  c  o  m
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to handle every type.
 */
@Nonnull
default <A, B, C> TriFunction<A, B, C, R> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2, @Nonnull final ToIntFunction<? super C> before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (a, b, c) -> apply(before1.applyAsInt(a), before2.applyAsInt(b), before3.applyAsInt(c));
}

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

/**
 * Returns a composed {@link TriFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @param <C> The type of the argument to the third given function, and of composed function
 * @param before1 The first function to apply before this function is applied
 * @param before2 The second function to apply before this function is applied
 * @param before3 The third function to apply before this function is applied
 * @return A composed {@code TriFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//from   w  ww . ja v  a2  s  .  c om
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to handle every type.
 */
@Nonnull
default <A, B, C> TriFunction<A, B, C, R> compose(@Nonnull final Function<? super A, ? extends T> before1,
        @Nonnull final ToIntFunction<? super B> before2, @Nonnull final ToIntFunction<? super C> before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (a, b, c) -> apply(before1.apply(a), before2.applyAsInt(b), before3.applyAsInt(c));
}

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

/**
 * Returns a composed {@link TriFunction} 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.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @param <C> The type of the argument to the third given function, and of composed function
 * @param before1 The first function to apply before this function is applied
 * @param before2 The second function to apply before this function is applied
 * @param before3 The third function to apply before this function is applied
 * @return A composed {@code TriFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.//from  ww 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 able to handle every type.
 */
@Nonnull
default <A, B, C> TriFunction<A, B, C, R> compose(@Nonnull final Function<? super A, ? extends T> before1,
        @Nonnull final Function<? super B, ? extends U> before2,
        @Nonnull final ToIntFunction<? super C> before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (a, b, c) -> apply(before1.apply(a), before2.apply(b), before3.applyAsInt(c));
}

From source file:at.gridtec.lambda4j.operator.binary.IntBinaryOperator2.java

/**
 * Returns a composed {@link ToIntBiFunction2} that first applies the {@code before} functions to its input, and
 * then applies this operator to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <A> The type of the argument to the first given function, and of composed function
 * @param <B> The type of the argument to the second given function, and of composed function
 * @param before1 The first function to apply before this operator is applied
 * @param before2 The second function to apply before this operator is applied
 * @return A composed {@code ToIntBiFunction2} that first applies the {@code before} functions to its input, and
 * then applies this operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to handle every type.
 *///from w w  w.  jav a  2s  . c  o m
@Nonnull
default <A, B> ToIntBiFunction2<A, B> compose(@Nonnull final ToIntFunction<? super A> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> applyAsInt(before1.applyAsInt(a), before2.applyAsInt(b));
}

From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjIntPredicate.java

/**
 * Returns a composed {@link BiPredicate2} that first applies the {@code before} functions to its input, and
 * then applies this predicate to the result.
 * If evaluation of either operation throws an exception, it is relayed to the caller of the composed operation.
 *
 * @param <A> The type of the argument to the first given function, and of composed predicate
 * @param <B> The type of the argument to the second given function, and of composed predicate
 * @param before1 The first function to apply before this predicate is applied
 * @param before2 The second function to apply before this predicate is applied
 * @return A composed {@code BiPredicate2} that first applies the {@code before} functions to its input, and then
 * applies this predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is able to handle every type.
 *//*from w ww . ja  v  a  2  s.  c  o m*/
@Nonnull
default <A, B> BiPredicate2<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1,
        @Nonnull final ToIntFunction<? super B> before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (a, b) -> test(before1.apply(a), before2.applyAsInt(b));
}