提交 e02f15e3 编写于 作者: P psandoz

8015792: Rename Spliterators.spliteratorFromIterator to Spliterators.iterator

Reviewed-by: chegar
上级 206c4375
...@@ -663,7 +663,7 @@ public final class Spliterators { ...@@ -663,7 +663,7 @@ public final class Spliterators {
* @return An iterator * @return An iterator
* @throws NullPointerException if the given spliterator is {@code null} * @throws NullPointerException if the given spliterator is {@code null}
*/ */
public static<T> Iterator<T> iteratorFromSpliterator(Spliterator<? extends T> spliterator) { public static<T> Iterator<T> iterator(Spliterator<? extends T> spliterator) {
Objects.requireNonNull(spliterator); Objects.requireNonNull(spliterator);
class Adapter implements Iterator<T>, Consumer<T> { class Adapter implements Iterator<T>, Consumer<T> {
boolean valueReady = false; boolean valueReady = false;
...@@ -708,7 +708,7 @@ public final class Spliterators { ...@@ -708,7 +708,7 @@ public final class Spliterators {
* @return An iterator * @return An iterator
* @throws NullPointerException if the given spliterator is {@code null} * @throws NullPointerException if the given spliterator is {@code null}
*/ */
public static PrimitiveIterator.OfInt iteratorFromSpliterator(Spliterator.OfInt spliterator) { public static PrimitiveIterator.OfInt iterator(Spliterator.OfInt spliterator) {
Objects.requireNonNull(spliterator); Objects.requireNonNull(spliterator);
class Adapter implements PrimitiveIterator.OfInt, IntConsumer { class Adapter implements PrimitiveIterator.OfInt, IntConsumer {
boolean valueReady = false; boolean valueReady = false;
...@@ -753,7 +753,7 @@ public final class Spliterators { ...@@ -753,7 +753,7 @@ public final class Spliterators {
* @return An iterator * @return An iterator
* @throws NullPointerException if the given spliterator is {@code null} * @throws NullPointerException if the given spliterator is {@code null}
*/ */
public static PrimitiveIterator.OfLong iteratorFromSpliterator(Spliterator.OfLong spliterator) { public static PrimitiveIterator.OfLong iterator(Spliterator.OfLong spliterator) {
Objects.requireNonNull(spliterator); Objects.requireNonNull(spliterator);
class Adapter implements PrimitiveIterator.OfLong, LongConsumer { class Adapter implements PrimitiveIterator.OfLong, LongConsumer {
boolean valueReady = false; boolean valueReady = false;
...@@ -798,7 +798,7 @@ public final class Spliterators { ...@@ -798,7 +798,7 @@ public final class Spliterators {
* @return An iterator * @return An iterator
* @throws NullPointerException if the given spliterator is {@code null} * @throws NullPointerException if the given spliterator is {@code null}
*/ */
public static PrimitiveIterator.OfDouble iteratorFromSpliterator(Spliterator.OfDouble spliterator) { public static PrimitiveIterator.OfDouble iterator(Spliterator.OfDouble spliterator) {
Objects.requireNonNull(spliterator); Objects.requireNonNull(spliterator);
class Adapter implements PrimitiveIterator.OfDouble, DoubleConsumer { class Adapter implements PrimitiveIterator.OfDouble, DoubleConsumer {
boolean valueReady = false; boolean valueReady = false;
......
...@@ -168,7 +168,7 @@ abstract class DoublePipeline<E_IN> ...@@ -168,7 +168,7 @@ abstract class DoublePipeline<E_IN>
@Override @Override
public final PrimitiveIterator.OfDouble iterator() { public final PrimitiveIterator.OfDouble iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
......
...@@ -172,7 +172,7 @@ abstract class IntPipeline<E_IN> ...@@ -172,7 +172,7 @@ abstract class IntPipeline<E_IN>
@Override @Override
public final PrimitiveIterator.OfInt iterator() { public final PrimitiveIterator.OfInt iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
......
...@@ -169,7 +169,7 @@ abstract class LongPipeline<E_IN> ...@@ -169,7 +169,7 @@ abstract class LongPipeline<E_IN>
@Override @Override
public final PrimitiveIterator.OfLong iterator() { public final PrimitiveIterator.OfLong iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
......
...@@ -137,7 +137,7 @@ abstract class ReferencePipeline<P_IN, P_OUT> ...@@ -137,7 +137,7 @@ abstract class ReferencePipeline<P_IN, P_OUT>
@Override @Override
public final Iterator<P_OUT> iterator() { public final Iterator<P_OUT> iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
......
...@@ -227,7 +227,7 @@ class SpinedBuffer<E> ...@@ -227,7 +227,7 @@ class SpinedBuffer<E>
@Override @Override
public Iterator<E> iterator() { public Iterator<E> iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
...@@ -712,7 +712,7 @@ class SpinedBuffer<E> ...@@ -712,7 +712,7 @@ class SpinedBuffer<E>
@Override @Override
public PrimitiveIterator.OfInt iterator() { public PrimitiveIterator.OfInt iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
public Spliterator.OfInt spliterator() { public Spliterator.OfInt spliterator() {
...@@ -815,7 +815,7 @@ class SpinedBuffer<E> ...@@ -815,7 +815,7 @@ class SpinedBuffer<E>
@Override @Override
public PrimitiveIterator.OfLong iterator() { public PrimitiveIterator.OfLong iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
...@@ -919,7 +919,7 @@ class SpinedBuffer<E> ...@@ -919,7 +919,7 @@ class SpinedBuffer<E>
@Override @Override
public PrimitiveIterator.OfDouble iterator() { public PrimitiveIterator.OfDouble iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
public Spliterator.OfDouble spliterator() { public Spliterator.OfDouble spliterator() {
......
...@@ -170,7 +170,7 @@ public class SpliteratorTraversingAndSplittingTest { ...@@ -170,7 +170,7 @@ public class SpliteratorTraversingAndSplittingTest {
() -> Spliterators.spliteratorUnknownSize(exp.iterator(), 0)); () -> Spliterators.spliteratorUnknownSize(exp.iterator(), 0));
db.add("Spliterators.spliterator(Spliterators.iteratorFromSpliterator(Spliterator ), ...)", db.add("Spliterators.spliterator(Spliterators.iteratorFromSpliterator(Spliterator ), ...)",
() -> Spliterators.spliterator(Spliterators.iteratorFromSpliterator(exp.spliterator()), exp.size(), 0)); () -> Spliterators.spliterator(Spliterators.iterator(exp.spliterator()), exp.size(), 0));
db.add("Spliterators.spliterator(T[], ...)", db.add("Spliterators.spliterator(T[], ...)",
() -> Spliterators.spliterator(exp.toArray(new Integer[0]), 0)); () -> Spliterators.spliterator(exp.toArray(new Integer[0]), 0));
...@@ -549,10 +549,10 @@ public class SpliteratorTraversingAndSplittingTest { ...@@ -549,10 +549,10 @@ public class SpliteratorTraversingAndSplittingTest {
() -> Arrays.spliterator(exp)); () -> Arrays.spliterator(exp));
db.add("Spliterators.spliterator(PrimitiveIterator.OfInt, ...)", db.add("Spliterators.spliterator(PrimitiveIterator.OfInt, ...)",
() -> Spliterators.spliterator(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), exp.length, 0)); () -> Spliterators.spliterator(Spliterators.iterator(Arrays.spliterator(exp)), exp.length, 0));
db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfInt, ...)", db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfInt, ...)",
() -> Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), 0)); () -> Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(exp)), 0));
class IntSpliteratorFromArray extends Spliterators.AbstractIntSpliterator { class IntSpliteratorFromArray extends Spliterators.AbstractIntSpliterator {
int[] a; int[] a;
...@@ -702,10 +702,10 @@ public class SpliteratorTraversingAndSplittingTest { ...@@ -702,10 +702,10 @@ public class SpliteratorTraversingAndSplittingTest {
() -> Arrays.spliterator(exp)); () -> Arrays.spliterator(exp));
db.add("Spliterators.spliterator(PrimitiveIterator.OfLong, ...)", db.add("Spliterators.spliterator(PrimitiveIterator.OfLong, ...)",
() -> Spliterators.spliterator(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), exp.length, 0)); () -> Spliterators.spliterator(Spliterators.iterator(Arrays.spliterator(exp)), exp.length, 0));
db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfLong, ...)", db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfLong, ...)",
() -> Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), 0)); () -> Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(exp)), 0));
class LongSpliteratorFromArray extends Spliterators.AbstractLongSpliterator { class LongSpliteratorFromArray extends Spliterators.AbstractLongSpliterator {
long[] a; long[] a;
...@@ -862,10 +862,10 @@ public class SpliteratorTraversingAndSplittingTest { ...@@ -862,10 +862,10 @@ public class SpliteratorTraversingAndSplittingTest {
() -> Arrays.spliterator(exp)); () -> Arrays.spliterator(exp));
db.add("Spliterators.spliterator(PrimitiveIterator.OfDouble, ...)", db.add("Spliterators.spliterator(PrimitiveIterator.OfDouble, ...)",
() -> Spliterators.spliterator(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), exp.length, 0)); () -> Spliterators.spliterator(Spliterators.iterator(Arrays.spliterator(exp)), exp.length, 0));
db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfDouble, ...)", db.add("Spliterators.spliteratorUnknownSize(PrimitiveIterator.OfDouble, ...)",
() -> Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(exp)), 0)); () -> Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(exp)), 0));
class DoubleSpliteratorFromArray extends Spliterators.AbstractDoubleSpliterator { class DoubleSpliteratorFromArray extends Spliterators.AbstractDoubleSpliterator {
double[] a; double[] a;
......
...@@ -45,7 +45,7 @@ public interface TestData<T, S extends BaseStream<T, S>> ...@@ -45,7 +45,7 @@ public interface TestData<T, S extends BaseStream<T, S>>
@Override @Override
default Iterator<T> iterator() { default Iterator<T> iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
Spliterator<T> spliterator(); Spliterator<T> spliterator();
...@@ -292,7 +292,7 @@ public interface TestData<T, S extends BaseStream<T, S>> ...@@ -292,7 +292,7 @@ public interface TestData<T, S extends BaseStream<T, S>>
@Override @Override
public PrimitiveIterator.OfInt iterator() { public PrimitiveIterator.OfInt iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
...@@ -317,7 +317,7 @@ public interface TestData<T, S extends BaseStream<T, S>> ...@@ -317,7 +317,7 @@ public interface TestData<T, S extends BaseStream<T, S>>
@Override @Override
public PrimitiveIterator.OfLong iterator() { public PrimitiveIterator.OfLong iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
...@@ -342,7 +342,7 @@ public interface TestData<T, S extends BaseStream<T, S>> ...@@ -342,7 +342,7 @@ public interface TestData<T, S extends BaseStream<T, S>>
@Override @Override
public PrimitiveIterator.OfDouble iterator() { public PrimitiveIterator.OfDouble iterator() {
return Spliterators.iteratorFromSpliterator(spliterator()); return Spliterators.iterator(spliterator());
} }
@Override @Override
......
...@@ -48,7 +48,7 @@ public class DoubleNodeTest extends OpTestCase { ...@@ -48,7 +48,7 @@ public class DoubleNodeTest extends OpTestCase {
List<Node<Double>> nodes = new ArrayList<>(); List<Node<Double>> nodes = new ArrayList<>();
nodes.add(Nodes.node(array)); nodes.add(Nodes.node(array));
nodes.add(degenerateTree(Spliterators.iteratorFromSpliterator(Arrays.spliterator(array)))); nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array))));
nodes.add(tree(toList(array), l -> Nodes.node(toDoubleArray(l)))); nodes.add(tree(toList(array), l -> Nodes.node(toDoubleArray(l))));
nodes.add(fill(array, Nodes.doubleBuilder(array.length))); nodes.add(fill(array, Nodes.doubleBuilder(array.length)));
nodes.add(fill(array, Nodes.doubleBuilder())); nodes.add(fill(array, Nodes.doubleBuilder()));
......
...@@ -48,7 +48,7 @@ public class IntNodeTest extends OpTestCase { ...@@ -48,7 +48,7 @@ public class IntNodeTest extends OpTestCase {
List<Node<Integer>> nodes = new ArrayList<>(); List<Node<Integer>> nodes = new ArrayList<>();
nodes.add(Nodes.node(array)); nodes.add(Nodes.node(array));
nodes.add(degenerateTree(Spliterators.iteratorFromSpliterator(Arrays.spliterator(array)))); nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array))));
nodes.add(tree(toList(array), l -> Nodes.node(toIntArray(l)))); nodes.add(tree(toList(array), l -> Nodes.node(toIntArray(l))));
nodes.add(fill(array, Nodes.intBuilder(array.length))); nodes.add(fill(array, Nodes.intBuilder(array.length)));
nodes.add(fill(array, Nodes.intBuilder())); nodes.add(fill(array, Nodes.intBuilder()));
......
...@@ -48,7 +48,7 @@ public class LongNodeTest extends OpTestCase { ...@@ -48,7 +48,7 @@ public class LongNodeTest extends OpTestCase {
List<Node<Long>> nodes = new ArrayList<>(); List<Node<Long>> nodes = new ArrayList<>();
nodes.add(Nodes.node(array)); nodes.add(Nodes.node(array));
nodes.add(degenerateTree(Spliterators.iteratorFromSpliterator(Arrays.spliterator(array)))); nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array))));
nodes.add(tree(toList(array), l -> Nodes.node(toLongArray(l)))); nodes.add(tree(toList(array), l -> Nodes.node(toLongArray(l))));
nodes.add(fill(array, Nodes.longBuilder(array.length))); nodes.add(fill(array, Nodes.longBuilder(array.length)));
nodes.add(fill(array, Nodes.longBuilder())); nodes.add(fill(array, Nodes.longBuilder()));
......
...@@ -150,7 +150,7 @@ public class SortedOpTest extends OpTestCase { ...@@ -150,7 +150,7 @@ public class SortedOpTest extends OpTestCase {
} }
private IntStream unknownSizeIntStream(int[] a) { private IntStream unknownSizeIntStream(int[] a) {
return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(a)), 0)); return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(a)), 0));
} }
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class) @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
...@@ -193,7 +193,7 @@ public class SortedOpTest extends OpTestCase { ...@@ -193,7 +193,7 @@ public class SortedOpTest extends OpTestCase {
} }
private LongStream unknownSizeLongStream(long[] a) { private LongStream unknownSizeLongStream(long[] a) {
return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(a)), 0)); return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(a)), 0));
} }
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class) @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
...@@ -236,7 +236,7 @@ public class SortedOpTest extends OpTestCase { ...@@ -236,7 +236,7 @@ public class SortedOpTest extends OpTestCase {
} }
private DoubleStream unknownSizeDoubleStream(double[] a) { private DoubleStream unknownSizeDoubleStream(double[] a) {
return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(Spliterators.iteratorFromSpliterator(Arrays.spliterator(a)), 0)); return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(Spliterators.iterator(Arrays.spliterator(a)), 0));
} }
@Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class) @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册