@@ -1947,7 +1947,8 @@ public static <T> Iterator<List<T>> chop(Iterator<T> self, Iterator<Integer> cho
1947
1947
* <p>
1948
1948
* Example usage:
1949
1949
* <pre class="groovyTestCase">
1950
- * def shape = Iterators.iterate(1, n {@code ->} n + 2).take(10).plus([3] * 3)
1950
+ * def trunk = [3, 3, 3].iterator()
1951
+ * def shape = Iterators.iterate(1, n {@code ->} n + 2).take(10).plus(trunk)
1951
1952
* def tree = ['*']
1952
1953
* .repeat()
1953
1954
* .chop(true, shape)
@@ -11134,22 +11135,6 @@ public static <T> Iterator<T> plus(Iterator<T> left, Iterator<T> right) {
11134
11135
return new PlusIterator<>(left, right);
11135
11136
}
11136
11137
11137
- /**
11138
- * Appends an iterator and an iterable.
11139
- *
11140
- * <pre class="groovyTestCase">
11141
- * assert [1, 2].iterator().plus([3, 4]).toList() == 1..4
11142
- * </pre>
11143
- *
11144
- * @param left an Iterator
11145
- * @param right an Iterable
11146
- * @return an iterator of all the items from first then second
11147
- * @since 5.0.0
11148
- */
11149
- public static <T> Iterator<T> plus(Iterator<T> left, Iterable<T> right) {
11150
- return plus(left, right.iterator());
11151
- }
11152
-
11153
11138
private static final class PlusIterator<E> implements Iterator<E> {
11154
11139
private final Iterator<E> first;
11155
11140
private final Iterator<E> second;
@@ -17100,27 +17085,6 @@ public static <U, V> Iterator<Tuple2<U, V>> zip(Iterator<U> self, Iterator<V> ot
17100
17085
return new ZipIterator<>(self, other);
17101
17086
}
17102
17087
17103
- /**
17104
- * An iterator of all the pairs from this iterator and the iterable.
17105
- * If the sources are of different sizes, the result will have the same
17106
- * size as the shorter one.
17107
- * <p>
17108
- * Example:
17109
- * <pre class="groovyTestCase">
17110
- * def small = [1, 2, 3].iterator()
17111
- * def large = [100, 200, 300]
17112
- * assert [101, 202, 303] == small.zip(large).collect{ a, b {@code ->} a + b }
17113
- * </pre>
17114
- *
17115
- * @param self an Iterator
17116
- * @param other an Iterable
17117
- * @return an iterator of all the pairs from self and other
17118
- * @since 5.0.0
17119
- */
17120
- public static <U, V> Iterator<Tuple2<U, V>> zip(Iterator<U> self, Iterable<V> other) {
17121
- return zip(self, other.iterator());
17122
- }
17123
-
17124
17088
private static final class ZipIterator<U, V> implements Iterator<Tuple2<U, V>> {
17125
17089
private final Iterator<U> delegate;
17126
17090
private final Iterator<V> other;
@@ -17199,29 +17163,6 @@ public static <U, V> Iterator<Tuple2<U, V>> zipAll(Iterator<U> left, Iterator<V>
17199
17163
return new ZipAllIterator<>(left, right, leftDefault, rightDefault);
17200
17164
}
17201
17165
17202
- /**
17203
- * An iterator of all the pairs of an Iterator and an Iterable with potentially different numbers of elements.
17204
- * If the iterables are of different sizes, the result will have the same
17205
- * size as the longer one with values completed using the provided default.
17206
- * <p>
17207
- * Example:
17208
- * <pre class="groovyTestCase">
17209
- * def ab = ['a', 'b'].iterator()
17210
- * def abcd = ('a'..'d').iterator()
17211
- * def nums = (1..3)
17212
- * assert ['a1', 'b2', 'unknown3'] == ab.zipAll(nums, 'unknown', 0).collect{ a, b {@code ->} a + b }
17213
- * assert ['a1', 'b2', 'c3', 'd0'] == abcd.zipAll(nums, 'unknown', 0).collect{ a, b {@code ->} a + b }
17214
- * </pre>
17215
- *
17216
- * @param left an Iterator
17217
- * @param right an Iterable
17218
- * @return an iterator of all the pairs from left and right
17219
- * @since 5.0.0
17220
- */
17221
- public static <U, V> Iterator<Tuple2<U, V>> zipAll(Iterator<U> left, Iterable<V> right, U leftDefault, V rightDefault) {
17222
- return zipAll(left, right.iterator(), leftDefault, rightDefault);
17223
- }
17224
-
17225
17166
private static final class ZipAllIterator<U, V> implements Iterator<Tuple2<U, V>> {
17226
17167
private final Iterator<U> left;
17227
17168
private final Iterator<V> right;
0 commit comments