List of usage examples for java.util.function DoubleConsumer accept
void accept(double value);
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjByteToDoubleFunction.java
/** * Returns a composed {@link BiObjByteConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjByteConsumer} that first applies this function to its input, and then consumes the * result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} */// w w w .ja va 2s .c o m @Nonnull default BiObjByteConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjCharToDoubleFunction.java
/** * Returns a composed {@link BiObjCharConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjCharConsumer} that first applies this function to its input, and then consumes the * result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *///from w w w. jav a 2 s . c om @Nonnull default BiObjCharConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjFloatToDoubleFunction.java
/** * Returns a composed {@link BiObjFloatConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjFloatConsumer} that first applies this function to its input, and then consumes * the result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *///from w w w . ja v a2s . c o m @Nonnull default BiObjFloatConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjShortToDoubleFunction.java
/** * Returns a composed {@link BiObjShortConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjShortConsumer} that first applies this function to its input, and then consumes * the result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *///from www . ja v a 2s .com @Nonnull default BiObjShortConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjDoubleToDoubleFunction.java
/** * Returns a composed {@link BiObjDoubleConsumer} that fist applies this function to its input, and then consumes * the result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjDoubleConsumer} that first applies this function to its input, and then consumes * the result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *//* w w w. j a v a 2 s . c om*/ @Nonnull default BiObjDoubleConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjIntToDoubleFunction.java
/** * Returns a composed {@link BiObjIntConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjIntConsumer} that first applies this function to its input, and then consumes the * result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *///from ww w .ja v a 2s .co m @Nonnull default BiObjIntConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjLongToDoubleFunction.java
/** * Returns a composed {@link BiObjLongConsumer} that fist applies this function to its input, and then consumes the * result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjLongConsumer} that first applies this function to its input, and then consumes the * result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} *///from w w w .j ava2 s . c o m @Nonnull default BiObjLongConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:at.gridtec.lambda4j.function.tri.obj.BiObjBooleanToDoubleFunction.java
/** * Returns a composed {@link BiObjBooleanConsumer} that fist applies this function to its input, and then consumes * the result using the given {@link DoubleConsumer}. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. * * @param consumer The operation which consumes the result from this operation * @return A composed {@code BiObjBooleanConsumer} that first applies this function to its input, and then consumes * the result using the given {@code DoubleConsumer}. * @throws NullPointerException If given argument is {@code null} */// w ww.j av a2 s .c om @Nonnull default BiObjBooleanConsumer<T, U> consume(@Nonnull final DoubleConsumer consumer) { Objects.requireNonNull(consumer); return (t, u, value) -> consumer.accept(applyAsDouble(t, u, value)); }
From source file:de.bund.bfr.math.MathUtils.java
public static List<StartValues> createStartValuesList(List<ParamRange> ranges, int n, ToDoubleFunction<List<Double>> errorFunction, DoubleConsumer progessListener, ExecutionContext exec) throws CanceledExecutionException { List<StartValues> valuesList = new ArrayList<>(); for (int i = 0; i < n; i++) { valuesList.add(new StartValues(Collections.nCopies(ranges.size(), i + 1.0), Double.POSITIVE_INFINITY)); }/*from w w w. ja v a 2 s . c o m*/ List<Integer> paramStepIndex = new ArrayList<>(Collections.nCopies(ranges.size(), 0)); boolean done = false; int allStepSize = 1; int count = 0; for (ParamRange range : ranges) { allStepSize *= range.getStepCount(); } while (!done) { List<Double> values = new ArrayList<>(); for (int i = 0; i < ranges.size(); i++) { values.add(ranges.get(i).getMin() + paramStepIndex.get(i) * ranges.get(i).getStepSize()); } double error = errorFunction.applyAsDouble(values); if (Double.isFinite(error) || error < valuesList.get(n - 1).getError()) { for (int i = 0; i < n; i++) { if (error < valuesList.get(i).getError()) { valuesList.add(i, new StartValues(values, error)); valuesList.remove(n); break; } } } for (int i = 0;; i++) { if (i >= ranges.size()) { done = true; break; } paramStepIndex.set(i, paramStepIndex.get(i) + 1); if (paramStepIndex.get(i) >= ranges.get(i).getStepCount()) { paramStepIndex.set(i, 0); } else { break; } } if (exec != null) { exec.checkCanceled(); } progessListener.accept((double) ++count / (double) allStepSize); } return valuesList; }
From source file:org.briljantframework.array.AbstractDoubleArray.java
@Override public void forEachDouble(DoubleConsumer consumer) { for (int i = 0; i < size(); i++) { consumer.accept(get(i)); }//from w w w.jav a2s . c om }