List of usage examples for java.util.function IntUnaryOperator applyAsInt
int applyAsInt(int operand);
From source file:Main.java
public static void main(String[] args) { IntUnaryOperator i = (x) -> x * x; System.out.println(i.applyAsInt(2)); }
From source file:Main.java
public static void incrementEffectivelyFinalVar(IntUnaryOperator operator) { System.out.println("operator.applyAsInt(1) = " + operator.applyAsInt(1)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjIntToIntFunction.java
/** * Creates a {@link ObjIntToIntFunction} which uses the {@code second} parameter of this one as argument for the * given {@link IntUnaryOperator}./*w w w . j a va 2 s . com*/ * * @param <T> The type of the first argument to the function * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code ObjIntToIntFunction} which uses the {@code second} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjIntToIntFunction<T> onlySecond(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (t, value) -> operator.applyAsInt(value); }
From source file:at.gridtec.lambda4j.operator.binary.IntBinaryOperator2.java
/** * Creates a {@link IntBinaryOperator2} which uses the {@code first} parameter of this one as argument for the given * {@link IntUnaryOperator}.// w ww.j a v a 2s. c o m * * @param operator The operator which accepts the {@code first} parameter of this one * @return Creates a {@code IntBinaryOperator2} which uses the {@code first} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static IntBinaryOperator2 onlyFirst(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2) -> operator.applyAsInt(value1); }
From source file:at.gridtec.lambda4j.operator.binary.IntBinaryOperator2.java
/** * Creates a {@link IntBinaryOperator2} which uses the {@code second} parameter of this one as argument for the * given {@link IntUnaryOperator}./*from ww w .j av a 2 s.co m*/ * * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code IntBinaryOperator2} which uses the {@code second} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static IntBinaryOperator2 onlySecond(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2) -> operator.applyAsInt(value2); }
From source file:at.gridtec.lambda4j.operator.ternary.IntTernaryOperator.java
/** * Creates a {@link IntTernaryOperator} which uses the {@code first} parameter of this one as argument for the given * {@link IntUnaryOperator}.//from w ww .ja va2s .c om * * @param operator The operator which accepts the {@code first} parameter of this one * @return Creates a {@code IntTernaryOperator} which uses the {@code first} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static IntTernaryOperator onlyFirst(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsInt(value1); }
From source file:at.gridtec.lambda4j.operator.ternary.IntTernaryOperator.java
/** * Creates a {@link IntTernaryOperator} which uses the {@code second} parameter of this one as argument for the * given {@link IntUnaryOperator}.// w w w. java 2 s .c om * * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code IntTernaryOperator} which uses the {@code second} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static IntTernaryOperator onlySecond(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsInt(value2); }
From source file:at.gridtec.lambda4j.operator.ternary.IntTernaryOperator.java
/** * Creates a {@link IntTernaryOperator} which uses the {@code third} parameter of this one as argument for the given * {@link IntUnaryOperator}./* ww w . j a va2 s. c o m*/ * * @param operator The operator which accepts the {@code third} parameter of this one * @return Creates a {@code IntTernaryOperator} which uses the {@code third} parameter of this one as argument for * the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static IntTernaryOperator onlyThird(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsInt(value3); }
From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiIntToIntFunction.java
/** * Creates a {@link ObjBiIntToIntFunction} which uses the {@code second} parameter of this one as argument for the * given {@link IntUnaryOperator}.// w w w. j ava 2 s .c om * * @param <T> The type of the first argument to the function * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code ObjBiIntToIntFunction} which uses the {@code second} parameter of this one as argument * for the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjBiIntToIntFunction<T> onlySecond(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (t, value1, value2) -> operator.applyAsInt(value1); }
From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiIntToIntFunction.java
/** * Creates a {@link ObjBiIntToIntFunction} which uses the {@code third} parameter of this one as argument for the * given {@link IntUnaryOperator}./*from ww w.ja va 2 s . c o m*/ * * @param <T> The type of the first argument to the function * @param operator The operator which accepts the {@code third} parameter of this one * @return Creates a {@code ObjBiIntToIntFunction} which uses the {@code third} parameter of this one as argument * for the given {@code IntUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjBiIntToIntFunction<T> onlyThird(@Nonnull final IntUnaryOperator operator) { Objects.requireNonNull(operator); return (t, value1, value2) -> operator.applyAsInt(value2); }