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.obj.ObjIntFunction.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 operator 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  ww  w.j a v a2 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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntUnaryOperator before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsInt(value2));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjLongFunction.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  av  a2 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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntToLongFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsLong(value2));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjFloatFunction.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  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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntToFloatFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsFloat(value2));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjShortFunction.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 www .j a  v a2 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 IntToShortFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsShort(value2));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleFunction.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 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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1,
        @Nonnull final IntToDoubleFunction before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.applyAsDouble(value2));
}

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

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

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

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

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

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

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

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

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

/**
 * Returns a composed {@link ObjShortFunction} 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 ObjShortFunction} 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 a2s .c  om
@Nonnull
default <S> ObjShortFunction<T, S> andThen(@Nonnull final IntFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value) -> after.apply(applyAsInt(t, value));
}