Java Code Examples for java.util.PrimitiveIterator#OfDouble
The following examples show how to use
java.util.PrimitiveIterator#OfDouble .
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: DoubleStream.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 2
Source File: DoubleStream.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 3
Source File: PrimitiveIteratorDefaults.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void testDoubleForEachRemainingWithNull() { PrimitiveIterator.OfDouble i = new PrimitiveIterator.OfDouble() { @Override public double nextDouble() { return 0; } @Override public boolean hasNext() { return false; } }; executeAndCatch(() -> i.forEachRemaining((DoubleConsumer) null)); executeAndCatch(() -> i.forEachRemaining((Consumer<Double>) null)); }
Example 4
Source File: PrimitiveIteratorDefaults.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void testDoubleForEachRemainingWithNull() { PrimitiveIterator.OfDouble i = new PrimitiveIterator.OfDouble() { @Override public double nextDouble() { return 0; } @Override public boolean hasNext() { return false; } }; executeAndCatch(() -> i.forEachRemaining((DoubleConsumer) null)); executeAndCatch(() -> i.forEachRemaining((Consumer<Double>) null)); }
Example 5
Source File: DoubleStream.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 6
Source File: PrimitiveIteratorDefaults.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void testDoubleForEachRemainingWithNull() { PrimitiveIterator.OfDouble i = new PrimitiveIterator.OfDouble() { @Override public double nextDouble() { return 0; } @Override public boolean hasNext() { return false; } }; executeAndCatch(() -> i.forEachRemaining((DoubleConsumer) null)); executeAndCatch(() -> i.forEachRemaining((Consumer<Double>) null)); }
Example 7
Source File: DoubleStream.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 8
Source File: PrimitiveIteratorDefaults.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void testDoubleForEachRemainingWithNull() { PrimitiveIterator.OfDouble i = new PrimitiveIterator.OfDouble() { @Override public double nextDouble() { return 0; } @Override public boolean hasNext() { return false; } }; executeAndCatch(() -> i.forEachRemaining((DoubleConsumer) null)); executeAndCatch(() -> i.forEachRemaining((Consumer<Double>) null)); }
Example 9
Source File: DoubleStream.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 10
Source File: DoubleStream.java From desugar_jdk_libs with GNU General Public License v2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * @param seed the initial element * @param f a function to be applied to to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() { double t = seed; @Override public boolean hasNext() { return true; } @Override public double nextDouble() { double v = t; t = f.applyAsDouble(t); return v; } }; return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false); }
Example 11
Source File: DoubleNodeTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Node.OfDouble degenerateTree(PrimitiveIterator.OfDouble it) { if (!it.hasNext()) { return Nodes.node(new double[0]); } double i = it.nextDouble(); if (it.hasNext()) { return new Nodes.ConcNode.OfDouble(Nodes.node(new double[] {i}), degenerateTree(it)); } else { return Nodes.node(new double[] {i}); } }
Example 12
Source File: SpinedBuffer.java From desugar_jdk_libs with GNU General Public License v2.0 | 4 votes |
@Override public PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }
Example 13
Source File: SpinedBuffer.java From JDKSourceCode1.8 with MIT License | 4 votes |
@Override public PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }
Example 14
Source File: DoubleStream.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override PrimitiveIterator.OfDouble iterator();
Example 15
Source File: DoublePipeline.java From JDKSourceCode1.8 with MIT License | 4 votes |
@Override public final PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }
Example 16
Source File: SpinedBuffer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }
Example 17
Source File: DoubleStream.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override PrimitiveIterator.OfDouble iterator();
Example 18
Source File: DoubleStream.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override PrimitiveIterator.OfDouble iterator();
Example 19
Source File: DoublePipeline.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public final PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }
Example 20
Source File: SpinedBuffer.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
@Override public PrimitiveIterator.OfDouble iterator() { return Spliterators.iterator(spliterator()); }