List of usage examples for java.util.function DoubleUnaryOperator applyAsDouble
double applyAsDouble(double operand);
From source file:Main.java
public static void main(String[] args) { DoubleUnaryOperator id = DoubleUnaryOperator.identity(); System.out.println(id.applyAsDouble(3.14)); }
From source file:Main.java
public static void main(String[] args) { DoubleUnaryOperator dl = (x) -> { return x * x; };//from w w w. j a v a 2 s. co m System.out.println(dl.applyAsDouble(3.14)); }
From source file:info.rmarcus.birkhoffvonneumann.MatrixUtils.java
public static void apply(double[][] dest, double[][] a, DoubleUnaryOperator f) { for (int i = 0; i < dest.length; i++) { for (int j = 0; j < dest[i].length; j++) { dest[i][j] = f.applyAsDouble(a[i][j]); }/*from w ww .j ava 2 s. c o m*/ } }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToDoubleFunction.java
/** * Creates a {@link ObjDoubleToDoubleFunction} which uses the {@code second} parameter of this one as argument for * the given {@link DoubleUnaryOperator}. * * @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 ObjDoubleToDoubleFunction} which uses the {@code second} parameter of this one as * argument for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} *///from w w w . j a v a 2 s . c om @Nonnull static <T> ObjDoubleToDoubleFunction<T> onlySecond(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (t, value) -> operator.applyAsDouble(value); }
From source file:at.gridtec.lambda4j.operator.binary.DoubleBinaryOperator2.java
/** * Creates a {@link DoubleBinaryOperator2} which uses the {@code first} parameter of this one as argument for the * given {@link DoubleUnaryOperator}.//from w w w . ja v a 2 s. c om * * @param operator The operator which accepts the {@code first} parameter of this one * @return Creates a {@code DoubleBinaryOperator2} which uses the {@code first} parameter of this one as argument * for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static DoubleBinaryOperator2 onlyFirst(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2) -> operator.applyAsDouble(value1); }
From source file:at.gridtec.lambda4j.operator.binary.DoubleBinaryOperator2.java
/** * Creates a {@link DoubleBinaryOperator2} which uses the {@code second} parameter of this one as argument for the * given {@link DoubleUnaryOperator}.//from w ww.j av a2s . com * * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code DoubleBinaryOperator2} which uses the {@code second} parameter of this one as argument * for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static DoubleBinaryOperator2 onlySecond(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2) -> operator.applyAsDouble(value2); }
From source file:at.gridtec.lambda4j.operator.ternary.DoubleTernaryOperator.java
/** * Creates a {@link DoubleTernaryOperator} which uses the {@code first} parameter of this one as argument for the * given {@link DoubleUnaryOperator}./* w w w . ja va 2 s.com*/ * * @param operator The operator which accepts the {@code first} parameter of this one * @return Creates a {@code DoubleTernaryOperator} which uses the {@code first} parameter of this one as argument * for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static DoubleTernaryOperator onlyFirst(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsDouble(value1); }
From source file:at.gridtec.lambda4j.operator.ternary.DoubleTernaryOperator.java
/** * Creates a {@link DoubleTernaryOperator} which uses the {@code second} parameter of this one as argument for the * given {@link DoubleUnaryOperator}./*from w w w .j ava 2 s . c o m*/ * * @param operator The operator which accepts the {@code second} parameter of this one * @return Creates a {@code DoubleTernaryOperator} which uses the {@code second} parameter of this one as argument * for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static DoubleTernaryOperator onlySecond(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsDouble(value2); }
From source file:at.gridtec.lambda4j.operator.ternary.DoubleTernaryOperator.java
/** * Creates a {@link DoubleTernaryOperator} which uses the {@code third} parameter of this one as argument for the * given {@link DoubleUnaryOperator}.// w w w . j av a 2 s . com * * @param operator The operator which accepts the {@code third} parameter of this one * @return Creates a {@code DoubleTernaryOperator} which uses the {@code third} parameter of this one as argument * for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static DoubleTernaryOperator onlyThird(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (value1, value2, value3) -> operator.applyAsDouble(value3); }
From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiDoubleToDoubleFunction.java
/** * Creates a {@link ObjBiDoubleToDoubleFunction} which uses the {@code second} parameter of this one as argument for * the given {@link DoubleUnaryOperator}. * * @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 ObjBiDoubleToDoubleFunction} which uses the {@code second} parameter of this one as * argument for the given {@code DoubleUnaryOperator}. * @throws NullPointerException If given argument is {@code null} *///w ww . ja v a 2s. c o m @Nonnull static <T> ObjBiDoubleToDoubleFunction<T> onlySecond(@Nonnull final DoubleUnaryOperator operator) { Objects.requireNonNull(operator); return (t, value1, value2) -> operator.applyAsDouble(value1); }