This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new 064530e1e Reuse IteratorUtils.chainedIterator(Iterator)
064530e1e is described below
commit 064530e1e0870b6dc2821100dbdbafb08cd415e3
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Nov 1 18:07:01 2024 -0400
Reuse IteratorUtils.chainedIterator(Iterator)
---
.../commons/collections4/iterators/ExtendedIterator.java | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git
a/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java
b/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java
index 662d35b89..711b93eec 100644
---
a/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java
+++
b/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java
@@ -23,6 +23,8 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
+import org.apache.commons.collections4.IteratorUtils;
+
/**
* Extends Iterator functionality to include operations commonly found on
streams (e.g. filtering, concatenating, mapping). It also provides convenience
methods
* for common operations.
@@ -87,14 +89,7 @@ public final class ExtendedIterator<T> implements
IteratorOperations<T> {
* @return An iterator over the logical concatenation of the inner
iterators.
*/
public static <T> ExtendedIterator<T> flatten(final Iterator<Iterator<T>>
iterators) {
- return create(new LazyIteratorChain<T>() {
-
- @Override
- protected Iterator<? extends T> nextIterator(final int count) {
- return iterators.hasNext() ? iterators.next() : null;
- }
-
- });
+ return create(IteratorUtils.chainedIterator(iterators));
}
/**