List of usage examples for java.util.function DoubleToIntFunction applyAsInt
int applyAsInt(double value);
From source file:at.gridtec.lambda4j.function.bi.to.ToDoubleBiFunction2.java
/** * Returns a composed {@link ToIntBiFunction2} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code ToIntBiFunction2} 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 a able to return primitive values. In this case this is {@code * int}.//from w w w. j a v a 2 s .c o m */ @Nonnull default ToIntBiFunction2<T, U> andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (t, u) -> after.applyAsInt(applyAsDouble(t, u)); }
From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java
/** * Returns a composed {@link ToIntTriFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code ToIntTriFunction} 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 a able to return primitive values. In this case this is {@code * int}./*from ww w . ja v a2 s . co m*/ */ @Nonnull default ToIntTriFunction<T, U, V> andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (t, u, v) -> after.applyAsInt(applyAsDouble(t, u, v)); }
From source file:at.gridtec.lambda4j.function.bi.BiIntFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}./* w w w . ja v a 2s .co m*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleToIntFunction before1, @Nonnull final DoubleToIntFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.applyAsInt(value1), before2.applyAsInt(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjIntFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}.//w ww . j a v a 2 s . c om */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToIntFunction 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.conversion.BiBooleanToDoubleFunction.java
/** * Returns a composed {@link BiBooleanToIntFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code BiBooleanToIntFunction} 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 a able to return primitive values. In this case this is {@code * int}.//from w w w . j a v a2 s . com */ @Nonnull default BiBooleanToIntFunction andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToDoubleFunction.java
/** * Returns a composed {@link BiByteToIntFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code BiByteToIntFunction} 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 a able to return primitive values. In this case this is {@code * int}./*from w w w. ja v a 2 s . c o m*/ */ @Nonnull default BiByteToIntFunction andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToDoubleFunction.java
/** * Returns a composed {@link BiCharToIntFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code BiCharToIntFunction} 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 a able to return primitive values. In this case this is {@code * int}./*w w w. j ava 2 s . com*/ */ @Nonnull default BiCharToIntFunction andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiFloatToDoubleFunction.java
/** * Returns a composed {@link BiFloatToIntFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code BiFloatToIntFunction} 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 a able to return primitive values. In this case this is {@code * int}./* w w w . j a v a 2 s . co m*/ */ @Nonnull default BiFloatToIntFunction andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiShortToDoubleFunction.java
/** * Returns a composed {@link BiShortToIntFunction} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code BiShortToIntFunction} 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 a able to return primitive values. In this case this is {@code * int}./*from www . jav a2s. co m*/ */ @Nonnull default BiShortToIntFunction andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiIntToDoubleFunction.java
/** * Returns a composed {@link IntBinaryOperator2} 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. This method is just convenience, to provide the ability to transform this * primitive function to an operation returning {@code int}. * * @param after The function to apply after this function is applied * @return A composed {@code IntBinaryOperator2} 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 a able to return primitive values. In this case this is {@code * int}.//w w w. j a v a 2s . c o m */ @Nonnull default IntBinaryOperator2 andThenToInt(@Nonnull final DoubleToIntFunction after) { Objects.requireNonNull(after); return (value1, value2) -> after.applyAsInt(applyAsDouble(value1, value2)); }