Example usage for java.util.function IntFunction apply

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

Introduction

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

Prototype

R apply(int value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:at.gridtec.lambda4j.function.tri.conversion.TriDoubleToIntFunction.java

/**
 * Returns a composed {@link TriDoubleFunction} 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 TriDoubleFunction} 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.
 *///  ww  w.  ja v  a  2 s  .c  o m
@Nonnull
default <S> TriDoubleFunction<S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (value1, value2, value3) -> after.apply(applyAsInt(value1, value2, value3));
}

From source file:at.gridtec.lambda4j.operator.ternary.IntTernaryOperator.java

/**
 * Returns a composed {@link TriIntFunction} that first applies this operator 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 operator is applied
 * @return A composed {@code TriIntFunction} that first applies this operator 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.  ja v  a 2  s. com
@Nonnull
default <S> TriIntFunction<S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (value1, value2, value3) -> after.apply(applyAsInt(value1, value2, value3));
}

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

/**
 * Returns a composed {@link ObjBiIntFunction} 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 ObjBiIntFunction} 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 a2  s. co  m*/
@Nonnull
default <S> ObjBiIntFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiByteFunction} 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 ObjBiByteFunction} 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 av  a 2s .  c  o m
@Nonnull
default <S> ObjBiByteFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiCharFunction} 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 ObjBiCharFunction} 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.
 *//* ww w .  ja  va2 s . co  m*/
@Nonnull
default <S> ObjBiCharFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiLongFunction} 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 ObjBiLongFunction} 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 ww  .  j  a  v  a  2  s. c om*/
@Nonnull
default <S> ObjBiLongFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiFloatFunction} 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 ObjBiFloatFunction} 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.
 *//* ww w  .  ja  v  a  2s .co  m*/
@Nonnull
default <S> ObjBiFloatFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiShortFunction} 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 ObjBiShortFunction} 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.  ja va  2  s  .  c  o m
@Nonnull
default <S> ObjBiShortFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link ObjBiBooleanFunction} 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 ObjBiBooleanFunction} 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  a 2s.  com
@Nonnull
default <S> ObjBiBooleanFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsInt(t, value1, value2));
}

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

/**
 * Returns a composed {@link TriIntConsumer} 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 int} 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 predicate to apply before this consumer is applied
 * @return A composed {@code TriIntConsumer} that first applies the {@code before} functions to its input, and then
 * applies this consumer to the result./*from   w w  w .j av a 2  s . com*/
 * @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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntPredicate before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.test(value3));
}