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.BiObjByteToIntFunction.java

/**
 * Returns a composed {@link BiObjByteFunction} 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 BiObjByteFunction} 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.ja  va 2s.c  o  m
@Nonnull
default <S> BiObjByteFunction<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.BiObjCharToIntFunction.java

/**
 * Returns a composed {@link BiObjCharFunction} 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 BiObjCharFunction} 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  v a2s .  c  o  m*/
@Nonnull
default <S> BiObjCharFunction<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.BiObjFloatToIntFunction.java

/**
 * Returns a composed {@link BiObjFloatFunction} 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 BiObjFloatFunction} 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  av a  2s .  c  o  m*/
@Nonnull
default <S> BiObjFloatFunction<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.BiObjShortToIntFunction.java

/**
 * Returns a composed {@link BiObjShortFunction} 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 BiObjShortFunction} 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  av a 2s .  c  o  m*/
@Nonnull
default <S> BiObjShortFunction<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.BiObjLongToIntFunction.java

/**
 * Returns a composed {@link BiObjLongFunction} 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 BiObjLongFunction} 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 va 2 s. c om*/
@Nonnull
default <S> BiObjLongFunction<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.BiObjDoubleToIntFunction.java

/**
 * Returns a composed {@link BiObjDoubleFunction} 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 BiObjDoubleFunction} 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.ja  va2s .  co  m*/
@Nonnull
default <S> BiObjDoubleFunction<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.bi.obj.ObjBooleanToByteFunction.java

/**
 * Returns a composed {@link BiIntToByteFunction} 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 int} 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 BiIntToByteFunction} 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 a able to handle primitive values. In this case this is {@code
 * int}./*from w w  w.j a v a 2 s.  c  o m*/
 */
@Nonnull
default BiIntToByteFunction composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> applyAsByte(before1.apply(value1), before2.test(value2));
}

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

/**
 * Returns a composed {@link BiIntToCharFunction} 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 int} 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 BiIntToCharFunction} 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 a able to handle primitive values. In this case this is {@code
 * int}./*  w ww  .ja va2  s. c o  m*/
 */
@Nonnull
default BiIntToCharFunction composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> applyAsChar(before1.apply(value1), before2.test(value2));
}

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

/**
 * Returns a composed {@link IntBinaryOperator2} 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 int} 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 IntBinaryOperator2} 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 a able to handle primitive values. In this case this is {@code
 * int}./*  w ww  .  j  a  v a 2  s . c  o  m*/
 */
@Nonnull
default IntBinaryOperator2 composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> applyAsInt(before1.apply(value1), before2.test(value2));
}

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

/**
 * Returns a composed {@link BiIntToFloatFunction} 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 int} 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 BiIntToFloatFunction} 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 a able to handle primitive values. In this case this is {@code
 * int}./*www .  ja  va2 s  .c o  m*/
 */
@Nonnull
default BiIntToFloatFunction composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> applyAsFloat(before1.apply(value1), before2.test(value2));
}