[ https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606211&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606211 ]
ASF GitHub Bot logged work on COLLECTIONS-795: ---------------------------------------------- Author: ASF GitHub Bot Created on: 03/Jun/21 20:56 Start Date: 03/Jun/21 20:56 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #238: URL: https://github.com/apache/commons-collections/pull/238#discussion_r645116336 ########## File path: src/main/java/org/apache/commons/collections4/IterableUtils.java ########## @@ -554,6 +555,34 @@ }; } + /** + * Provides iteration over the elements contained in a pair of Iterables in-tandem. + * <p> + * The returned iterable has an iterator that traverses the elements in {@code a} + * and {@code b} together until one of the iterables is traversed completely. + * <p> Review comment: Close HTML tags. ########## File path: src/main/java/org/apache/commons/collections4/IteratorUtils.java ########## @@ -127,7 +87,7 @@ private IteratorUtils() {} * @return an iterator over nothing */ public static <E> ResettableIterator<E> emptyIterator() { - return EmptyIterator.<E>resettableEmptyIterator(); + return EmptyIterator.resettableEmptyIterator(); Review comment: These changes are unrelated, small PRs are better for reviewers ;-) ########## File path: src/main/java/org/apache/commons/collections4/IterableUtils.java ########## @@ -554,6 +555,34 @@ }; } + /** + * Provides iteration over the elements contained in a pair of Iterables in-tandem. + * <p> + * The returned iterable has an iterator that traverses the elements in {@code a} + * and {@code b} together until one of the iterables is traversed completely. + * <p> + * The returned iterable's iterator does NOT support {@code remove()}. + * + * @param <L> the left elements' type + * @param <R> the right elements' type + * @param left the iterable for the left side elements + * @param right the iterable for the right side elements + * @return an iterable, over the decorated iterables to traverse them together until one is + * exhausted + * @throws NullPointerException if any iterator is null + */ Review comment: New public and protected method should have `@since 4.5` Javadoc tags. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 606211) Time Spent: 4.5h (was: 4h 20m) > provide a PairIterator to zip two iterators of different types. > --------------------------------------------------------------- > > Key: COLLECTIONS-795 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-795 > Project: Commons Collections > Issue Type: New Feature > Components: Iterator > Reporter: Anant Damle > Priority: Minor > Time Spent: 4.5h > Remaining Estimate: 0h > > ZippingIterator provides a way to simulatenously iterate over multiple > iterators of the *same-type.* > The proposed pair iterator allows simultaneously iterating over two iterators > of different type, like the example below: > {code:java} > Iterator<L> leftIterator = ...; > Iterator<R> rightIterator = ...; > PairIterator<L,R> pairIterator = PairIterator.of(leftIterator, rightIterator); > while (pairIterator.hasNext()) { > ImmutablePair<L,R> item = pairIterator.next(); > ... > }{code} > > Another convenience could be to use an Iterable for easy for-each constructs. > {code:java} > List<Integer> studentIds = ... > List<String> studentNames = ... > for (PairedItem<Integer, String> items : > IterableUtils.pairedIterable(studentIds, studentNames) { > Integer studentId = item.getLeft(); > String studentName = item.getRight(); > ... > } > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)