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.bi.conversion.BiBooleanToIntFunction.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * Returns a composed {@link BiIntFunction} 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 BiIntFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result.// ww w  .  java 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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntPredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.test(value2));
}

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

/**
 * Returns a composed {@link BiIntFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiIntFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from   w  w  w .  j a v a 2  s  .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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntToByteFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsByte(value2));
}

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

/**
 * Returns a composed {@link BiIntFunction} 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 function to apply before this function is applied
 * @return A composed {@code BiIntFunction} that first applies the {@code before} functions to its input, and then
 * applies this function to the result./*from  w w w .j  a  v  a2  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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntToCharFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsChar(value2));
}