Java Code Examples for java.util.function.DoubleConsumer#accept()
The following examples show how to use
java.util.function.DoubleConsumer#accept() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoublePipeline.java From j2objc with Apache License 2.0 | 6 votes |
@Override public final DoubleStream peek(DoubleConsumer action) { Objects.requireNonNull(action); return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE, 0) { @Override public Sink<Double> opWrapSink(int flags, Sink<Double> sink) { return new Sink.ChainedDouble<Double>(sink) { @Override public void accept(double t) { action.accept(t); downstream.accept(t); } }; } }; }
Example 2
Source File: ThreadLocalRandom.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void forEachRemaining(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { index = f; double o = origin, b = bound; ThreadLocalRandom rng = ThreadLocalRandom.current(); do { consumer.accept(rng.internalNextDouble(o, b)); } while (++i < f); } }
Example 3
Source File: Streams.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void forEachRemaining(DoubleConsumer action) { Objects.requireNonNull(action); if (count == -2) { action.accept(first); count = -1; } }
Example 4
Source File: Random.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void forEachRemaining(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { index = f; Random r = rng; double o = origin, b = bound; do { consumer.accept(r.internalNextDouble(o, b)); } while (++i < f); } }
Example 5
Source File: Random.java From hottub with GNU General Public License v2.0 | 5 votes |
public void forEachRemaining(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { index = f; Random r = rng; double o = origin, b = bound; do { consumer.accept(r.internalNextDouble(o, b)); } while (++i < f); } }
Example 6
Source File: Streams.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void forEachRemaining(DoubleConsumer action) { Objects.requireNonNull(action); if (count == -2) { action.accept(first); count = -1; } }
Example 7
Source File: Streams.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean tryAdvance(DoubleConsumer action) { Objects.requireNonNull(action); if (count == -2) { action.accept(first); count = -1; return true; } else { return false; } }
Example 8
Source File: ThreadLocalRandom.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public boolean tryAdvance(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { consumer.accept(ThreadLocalRandom.current().internalNextDouble(origin, bound)); index = i + 1; return true; } return false; }
Example 9
Source File: Random.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public boolean tryAdvance(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { consumer.accept(rng.internalNextDouble(origin, bound)); index = i + 1; return true; } return false; }
Example 10
Source File: SpinedBuffer.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override protected void arrayForEach(double[] array, int from, int to, DoubleConsumer consumer) { for (int i = from; i < to; i++) consumer.accept(array[i]); }
Example 11
Source File: ThreadLocalRandom.java From Java8CN with Apache License 2.0 | 5 votes |
public void forEachRemaining(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { index = f; double o = origin, b = bound; ThreadLocalRandom rng = ThreadLocalRandom.current(); do { consumer.accept(rng.internalNextDouble(o, b)); } while (++i < f); } }
Example 12
Source File: SpinedBuffer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void arrayForEach(double[] array, int from, int to, DoubleConsumer consumer) { for (int i = from; i < to; i++) consumer.accept(array[i]); }
Example 13
Source File: SpinedBuffer.java From j2objc with Apache License 2.0 | 5 votes |
@Override protected void arrayForEach(double[] array, int from, int to, DoubleConsumer consumer) { for (int i = from; i < to; i++) consumer.accept(array[i]); }
Example 14
Source File: Streams.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void forEachRemaining(DoubleConsumer action) { Objects.requireNonNull(action); if (count == -2) { action.accept(first); count = -1; } }
Example 15
Source File: ThreadLocalRandom.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public boolean tryAdvance(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { consumer.accept(ThreadLocalRandom.current().internalNextDouble(origin, bound)); index = i + 1; return true; } return false; }
Example 16
Source File: ThreadLocalRandom.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void forEachRemaining(DoubleConsumer consumer) { if (consumer == null) throw new NullPointerException(); long i = index, f = fence; if (i < f) { index = f; double o = origin, b = bound; ThreadLocalRandom rng = ThreadLocalRandom.current(); do { consumer.accept(rng.internalNextDouble(o, b)); } while (++i < f); } }
Example 17
Source File: Streams.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean tryAdvance(DoubleConsumer action) { Objects.requireNonNull(action); if (count == -2) { action.accept(first); count = -1; return true; } else { return false; } }
Example 18
Source File: StreamSpliterators.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override protected void acceptConsumed(DoubleConsumer action) { action.accept(tmpValue); }
Example 19
Source File: Nodes.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void forEach(DoubleConsumer consumer) { for (int i = 0; i < curSize; i++) { consumer.accept(array[i]); } }
Example 20
Source File: OptionalDouble.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Have the specified consumer accept the value if a value is present, * otherwise do nothing. * * @param consumer block to be executed if a value is present * @throws NullPointerException if value is present and {@code consumer} is * null */ public void ifPresent(DoubleConsumer consumer) { if (isPresent) consumer.accept(value); }