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.obj.ObjBiDoubleToIntFunction.java

/**
 * Returns a composed {@link ObjBiDoubleFunction} 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 ObjBiDoubleFunction} 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  .  j ava  2s  . c o  m
@Nonnull
default <S> ObjBiDoubleFunction<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.BiObjByteConsumer.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 function 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./*w ww.  j  a va  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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntToByteFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsByte(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjCharConsumer.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 function 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./*  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 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 IntToCharFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsChar(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjIntConsumer.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 operator 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 ww w  . 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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntUnaryOperator before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsInt(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjLongConsumer.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 function 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  ww  w.j  a v a 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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntToLongFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsLong(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjFloatConsumer.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 function 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./*  www.  j a  va  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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntToFloatFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsFloat(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjShortConsumer.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 function 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   ww w  . 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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntToShortFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsShort(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjDoubleConsumer.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 function 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./*ww w .jav 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
 * int}.
 */
@Nonnull
default TriIntConsumer composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntFunction<? extends U> before2, @Nonnull final IntToDoubleFunction 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.BiObjIntToIntFunction.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.
 *///  w w w. j av  a  2  s .c  o m
@Nonnull
default <S> BiObjIntFunction<T, U, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsInt(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjBooleanToIntFunction.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 av a 2 s .co m*/
@Nonnull
default <S> BiObjBooleanFunction<T, U, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsInt(t, u, value));
}