[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2022-01-20 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=712566=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-712566
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 21/Jan/22 02:19
Start Date: 21/Jan/22 02:19
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-1018102419


   Any updates on this one?


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 712566)
Time Spent: 7h 10m  (was: 7h)

> 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: 7h 10m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem items : 
> IterableUtils.pairedIterable(studentIds, studentNames) {
>   Integer studentId = item.getLeft();
>   String studentName = item.getRight();
>   ...
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-08-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=633077=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633077
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 03/Aug/21 17:53
Start Date: 03/Aug/21 17:53
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-892043814


   I'll try to take a look this week...


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 633077)
Time Spent: 7h  (was: 6h 50m)

> 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: 7h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-08-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=632849=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-632849
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 03/Aug/21 11:32
Start Date: 03/Aug/21 11:32
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-891771558


   @anantdamle 
   We are volunteers here, we do what we can when we can ;-)


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 632849)
Time Spent: 6h 50m  (was: 6h 40m)

> 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: 6h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-08-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=632734=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-632734
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 03/Aug/21 07:42
Start Date: 03/Aug/21 07:42
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-891614772


   sorry to nag! Any updates?


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 632734)
Time Spent: 6h 40m  (was: 6.5h)

> 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: 6h 40m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=612068=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-612068
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 18/Jun/21 21:16
Start Date: 18/Jun/21 21:16
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-863754751


   Gentle Bump: Any review comments or improvements


-- 
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: 612068)
Time Spent: 6.5h  (was: 6h 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: 6.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=611991=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-611991
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 18/Jun/21 21:06
Start Date: 18/Jun/21 21:06
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-863962396


   No bumping needed. We are all volunteers. We are all busy. Please be 
patient. 


-- 
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: 611991)
Time Spent: 6h 20m  (was: 6h 10m)

> 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: 6h 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=611670=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-611670
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 16/Jun/21 00:13
Start Date: 16/Jun/21 00:13
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-861915266


   Gentle bump: any comments or changes today I should be doing?


-- 
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: 611670)
Time Spent: 6h 10m  (was: 6h)

> 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: 6h 10m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=609634=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609634
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 10/Jun/21 10:39
Start Date: 10/Jun/21 10:39
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r649063964



##
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.
+ * 
+ * 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.
+ * 
+ * The returned iterable's iterator does NOT support {@code remove()}.
+ *
+ * @param  the left elements' type
+ * @param  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:
   Done




-- 
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: 609634)
Time Spent: 6h  (was: 5h 50m)

> 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: 6h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=609633=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609633
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 10/Jun/21 10:38
Start Date: 10/Jun/21 10:38
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r649063555



##
File path: src/main/java/org/apache/commons/collections4/IteratorUtils.java
##
@@ -127,7 +87,7 @@ private IteratorUtils() {}
  * @return an iterator over nothing
  */
 public static  ResettableIterator emptyIterator() {
-return EmptyIterator.resettableEmptyIterator();
+return EmptyIterator.resettableEmptyIterator();

Review comment:
   Done.

##
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.
+ * 
+ * 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.
+ * 

Review comment:
   Done.




-- 
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: 609633)
Time Spent: 5h 50m  (was: 5h 40m)

> 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: 5h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=609629=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609629
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 10/Jun/21 10:34
Start Date: 10/Jun/21 10:34
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-858510087


   @garydgregory gentle bump up.


-- 
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: 609629)
Time Spent: 5h 40m  (was: 5.5h)

> 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: 5h 40m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606864=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606864
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 08:32
Start Date: 04/Jun/21 08:32
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-854278433


   @garydgregory there is one big difference with ZippingIterator, 
ZippingIterator allows iterating over iteratord of same generic type, whereas 
the proposed solution allows using two different types and hence needs a Pair 
equivalent class.


-- 
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: 606864)
Time Spent: 5.5h  (was: 5h 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: 5.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606576=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606576
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 07:59
Start Date: 04/Jun/21 07:59
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.
+ * 
+ * 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.
+ * 

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  ResettableIterator emptyIterator() {
-return EmptyIterator.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.
+ * 
+ * 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.
+ * 
+ * The returned iterable's iterator does NOT support {@code remove()}.
+ *
+ * @param  the left elements' type
+ * @param  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: 606576)
Time Spent: 5h 20m  (was: 5h 10m)

> 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: 5h 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606545=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606545
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 07:56
Start Date: 04/Jun/21 07:56
Worklog Time Spent: 10m 
  Work Description: anantdamle edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-854278433






-- 
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: 606545)
Time Spent: 5h 10m  (was: 5h)

> 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: 5h 10m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606330=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606330
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 01:46
Start Date: 04/Jun/21 01:46
Worklog Time Spent: 10m 
  Work Description: anantdamle edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-854278433


   @garydgregory there is one big difference with ZippingIterator, 
`ZippingIterator` allows iterating over iterators of same generic type, 
whereas the proposed solution (`PairedIterator`) allows using two 
different types and hence needs a Pair equivalent class.
   Its also clearly demonstrated in the unit tests, by using Lists of two 
different types .


-- 
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: 606330)
Time Spent: 5h  (was: 4h 50m)

> 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: 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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606329=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606329
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 01:45
Start Date: 04/Jun/21 01:45
Worklog Time Spent: 10m 
  Work Description: anantdamle edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-854278433


   @garydgregory there is one big difference with ZippingIterator, 
ZippingIterator allows iterating over iteratordsof same generic type, whereas 
the proposed solution allows using two different types and hence needs a Pair 
equivalent class.
   Its also clearly demonstrated in the unit tests, by using Lists of two 
different types .


-- 
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: 606329)
Time Spent: 4h 50m  (was: 4h 40m)

> 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: 4h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606319=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606319
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 04/Jun/21 00:54
Start Date: 04/Jun/21 00:54
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-854278433


   @garydgregory there is one big difference with ZippingIterator, 
ZippingIterator allows iterating over iteratord of same generic type, whereas 
the proposed solution allows using two different types and hence needs a Pair 
equivalent class.


-- 
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: 606319)
Time Spent: 4h 40m  (was: 4.5h)

> 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: 4h 40m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-03 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=606211=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.
+ * 
+ * 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.
+ * 

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  ResettableIterator emptyIterator() {
-return EmptyIterator.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.
+ * 
+ * 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.
+ * 
+ * The returned iterable's iterator does NOT support {@code remove()}.
+ *
+ * @param  the left elements' type
+ * @param  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604901=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604901
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 02:13
Start Date: 02/Jun/21 02:13
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643602621



##
File path: src/test/java/org/apache/commons/collections4/PairedIterableTest.java
##
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+import org.junit.Before;
+import org.junit.Test;
+
+public final class PairedIterableTest {
+private ArrayList smallStringsList = null;

Review comment:
   done.




-- 
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: 604901)
Time Spent: 4h 20m  (was: 4h 10m)

> 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: 4h 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604900=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604900
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 02:13
Start Date: 02/Jun/21 02:13
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643575137



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java
##
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   PairedIterator> pairedIterator =
+ * PairedIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (pairedIterator.hasNext()) {
+ * PairedItem item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class PairedIterator implements Iterator> {
+
+/**
+ * The left {@link Iterator}s to evaluate.
+ */
+private final Iterator leftIterator;
+
+/**
+ * The right {@link Iterator}s to evaluate.
+ */
+private final Iterator rightIterator;
+
+// Constructor
+// --
+
+/**
+ * Constructs a new {@code ZipPairIterator} that will provide  iteration 
over the two given
+ * iterators.
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @throws NullPointerException if either iterator is null
+ */
+public PairedIterator(Iterator leftIterator, Iterator rightIterator) 
{
+this.leftIterator = requireNonNull(leftIterator);
+this.rightIterator = requireNonNull(rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @return the iterator to iterate over the provided iterators.
+ * @throws NullPointerException if either iterator is null
+ */
+public static  PairedIterator of(Iterator leftIterator, 
Iterator rightIterator) {
+return new PairedIterator<>(leftIterator, rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator from any 
{@link Iterable} sources.
+ *
+ * @param leftIterable  the iterable for the left side element.
+ * @param rightIterable the iterable for the right side element.
+ * @return the iterator to iterate over the iterators derived from the 
provided iterables.
+ * @throws NullPointerException if either iterables is null
+ */
+public static  PairedIterator ofIterables(Iterable 
leftIterable, Iterable rightIterable) {
+return of(requireNonNull(leftIterable).iterator(), 
requireNonNull(rightIterable).iterator());
+}
+
+// Iterator Methods
+// ---
+
+/**
+ * Returns {@code true} if both the child iterators have remaining 
elements.
+ *
+ * @return true if both the child iterators have remaining elements
+ */
+@Override
+public boolean hasNext() {
+return leftIterator.hasNext() && rightIterator.hasNext();
+}
+
+   

[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604899=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604899
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 02:12
Start Date: 02/Jun/21 02:12
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643602321



##
File path: 
src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.commons.collections4.IteratorUtils;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+
+/** Unit test suite for {@link ZippingIterator}. */
+public final class PairedIteratorTest
+extends AbstractIteratorTest> {
+
+// Conventional

Review comment:
   Removed.
   Had copied them from another test.




-- 
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: 604899)
Time Spent: 4h  (was: 3h 50m)

> 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: 4h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604898=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604898
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 02:11
Start Date: 02/Jun/21 02:11
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643602080



##
File path: src/main/java/org/apache/commons/collections4/IteratorUtils.java
##
@@ -907,6 +908,20 @@ public static NodeListIterator nodeListIterator(final Node 
node) {
 return new ZippingIterator<>(iterators);
 }
 
+/**
+ * Returns an iterator that provides the elements contained in a pair of 
Iterators.
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ * @param left the iterator for the left side elements
+ * @param right the iterator for the right side elements
+ * @return an iterator, to iterate over the decorated iterators together 
until one is exhausted
+ * @throws NullPointerException if any iterator is null

Review comment:
   Added a more descriptive Javadoc.




-- 
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: 604898)
Time Spent: 3h 50m  (was: 3h 40m)

> 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: 3h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604849=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604849
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 00:52
Start Date: 02/Jun/21 00:52
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643576883



##
File path: 
src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.commons.collections4.IteratorUtils;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+
+/** Unit test suite for {@link ZippingIterator}. */
+public final class PairedIteratorTest
+extends AbstractIteratorTest> {
+
+// Conventional
+
+public PairedIteratorTest(String testName) {
+super(testName);
+}
+
+// Lifecycle
+
+private ArrayList smallStringsList = null;
+private ArrayList largeStringsList = null;
+private ArrayList smallIntsList = null;
+private ArrayList largeIntsList = null;
+
+// Unequal sized lists
+private static final int SMALL_LIST_SIZE = 20;

Review comment:
   added two tests: `testLeftIteratorLargerThanRight` and 
`testRightIteratorLargerThanLeft` to match the tests of same name from 
PairedIteratorTest




-- 
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: 604849)
Time Spent: 3h 40m  (was: 3.5h)

> 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: 3h 40m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604848=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604848
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 00:50
Start Date: 02/Jun/21 00:50
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643576883



##
File path: 
src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.commons.collections4.IteratorUtils;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+
+/** Unit test suite for {@link ZippingIterator}. */
+public final class PairedIteratorTest
+extends AbstractIteratorTest> {
+
+// Conventional
+
+public PairedIteratorTest(String testName) {
+super(testName);
+}
+
+// Lifecycle
+
+private ArrayList smallStringsList = null;
+private ArrayList largeStringsList = null;
+private ArrayList smallIntsList = null;
+private ArrayList largeIntsList = null;
+
+// Unequal sized lists
+private static final int SMALL_LIST_SIZE = 20;

Review comment:
   Its asserted in two tests: `testLeftIteratorLargerThanRight` and 
`testRightIteratorLargerThanLeft`




-- 
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: 604848)
Time Spent: 3.5h  (was: 3h 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: 3.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604845=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604845
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 02/Jun/21 00:45
Start Date: 02/Jun/21 00:45
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r643575137



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java
##
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   PairedIterator> pairedIterator =
+ * PairedIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (pairedIterator.hasNext()) {
+ * PairedItem item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class PairedIterator implements Iterator> {
+
+/**
+ * The left {@link Iterator}s to evaluate.
+ */
+private final Iterator leftIterator;
+
+/**
+ * The right {@link Iterator}s to evaluate.
+ */
+private final Iterator rightIterator;
+
+// Constructor
+// --
+
+/**
+ * Constructs a new {@code ZipPairIterator} that will provide  iteration 
over the two given
+ * iterators.
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @throws NullPointerException if either iterator is null
+ */
+public PairedIterator(Iterator leftIterator, Iterator rightIterator) 
{
+this.leftIterator = requireNonNull(leftIterator);
+this.rightIterator = requireNonNull(rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @return the iterator to iterate over the provided iterators.
+ * @throws NullPointerException if either iterator is null
+ */
+public static  PairedIterator of(Iterator leftIterator, 
Iterator rightIterator) {
+return new PairedIterator<>(leftIterator, rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator from any 
{@link Iterable} sources.
+ *
+ * @param leftIterable  the iterable for the left side element.
+ * @param rightIterable the iterable for the right side element.
+ * @return the iterator to iterate over the iterators derived from the 
provided iterables.
+ * @throws NullPointerException if either iterables is null
+ */
+public static  PairedIterator ofIterables(Iterable 
leftIterable, Iterable rightIterable) {
+return of(requireNonNull(leftIterable).iterator(), 
requireNonNull(rightIterable).iterator());
+}
+
+// Iterator Methods
+// ---
+
+/**
+ * Returns {@code true} if both the child iterators have remaining 
elements.
+ *
+ * @return true if both the child iterators have remaining elements
+ */
+@Override
+public boolean hasNext() {
+return leftIterator.hasNext() && rightIterator.hasNext();
+}
+
+   

[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604741=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604741
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 01/Jun/21 19:42
Start Date: 01/Jun/21 19:42
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_r643425608



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java
##
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   PairedIterator> pairedIterator =
+ * PairedIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (pairedIterator.hasNext()) {
+ * PairedItem item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class PairedIterator implements Iterator> {
+
+/**
+ * The left {@link Iterator}s to evaluate.
+ */
+private final Iterator leftIterator;
+
+/**
+ * The right {@link Iterator}s to evaluate.
+ */
+private final Iterator rightIterator;
+
+// Constructor
+// --
+
+/**
+ * Constructs a new {@code ZipPairIterator} that will provide  iteration 
over the two given
+ * iterators.
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @throws NullPointerException if either iterator is null
+ */
+public PairedIterator(Iterator leftIterator, Iterator rightIterator) 
{
+this.leftIterator = requireNonNull(leftIterator);
+this.rightIterator = requireNonNull(rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator
+ *
+ * @param leftIterator  the iterator for the left side element.
+ * @param rightIterator the iterator for the right side element.
+ * @return the iterator to iterate over the provided iterators.
+ * @throws NullPointerException if either iterator is null
+ */
+public static  PairedIterator of(Iterator leftIterator, 
Iterator rightIterator) {
+return new PairedIterator<>(leftIterator, rightIterator);
+}
+
+/**
+ * Convenience static factory to construct the ZipPairIterator from any 
{@link Iterable} sources.
+ *
+ * @param leftIterable  the iterable for the left side element.
+ * @param rightIterable the iterable for the right side element.
+ * @return the iterator to iterate over the iterators derived from the 
provided iterables.
+ * @throws NullPointerException if either iterables is null
+ */
+public static  PairedIterator ofIterables(Iterable 
leftIterable, Iterable rightIterable) {
+return of(requireNonNull(leftIterable).iterator(), 
requireNonNull(rightIterable).iterator());
+}
+
+// Iterator Methods
+// ---
+
+/**
+ * Returns {@code true} if both the child iterators have remaining 
elements.
+ *
+ * @return true if both the child iterators have remaining elements
+ */
+@Override
+public boolean hasNext() {
+return leftIterator.hasNext() && rightIterator.hasNext();
+}
+
+ 

[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=604626=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604626
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 01/Jun/21 17:04
Start Date: 01/Jun/21 17:04
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-852291238


   What are the next steps?


-- 
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: 604626)
Time Spent: 3h  (was: 2h 50m)

> 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: 3h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603788=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603788
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 29/May/21 04:31
Start Date: 29/May/21 04:31
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850767579


   Added tests to improve coverage 


-- 
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: 603788)
Time Spent: 2h 50m  (was: 2h 40m)

> 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: 2h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603787=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603787
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 29/May/21 04:19
Start Date: 29/May/21 04:19
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850755538


   
   [![Coverage 
Status](https://coveralls.io/builds/40137659/badge)](https://coveralls.io/builds/40137659)
   
   Coverage decreased (-0.008%) to 90.134% when pulling 
**1ed50ce573ad05d3228cc59336fac76779eef326 on anantdamle:collections_795** into 
**0f54cb20903e75d43da9383464093a827e19b2e9 on apache:master**.
   


-- 
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: 603787)
Time Spent: 2h 40m  (was: 2.5h)

> 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: 2h 40m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603783=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603783
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 29/May/21 02:41
Start Date: 29/May/21 02:41
Worklog Time Spent: 10m 
  Work Description: coveralls commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850755538


   
   [![Coverage 
Status](https://coveralls.io/builds/40136935/badge)](https://coveralls.io/builds/40136935)
   
   Coverage decreased (-0.02%) to 90.127% when pulling 
**a9012fcbdd6c6f645280e8d560ca12a7c5f71234 on anantdamle:collections_795** into 
**0f54cb20903e75d43da9383464093a827e19b2e9 on apache:master**.
   


-- 
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: 603783)
Time Spent: 2.5h  (was: 2h 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: 2.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603782=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603782
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 29/May/21 02:39
Start Date: 29/May/21 02:39
Worklog Time Spent: 10m 
  Work Description: anantdamle edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850755188


   thanks @XenoAmess and @kinow 
   Fixed checkstyles issues (also checked locally using `mvn checkstyle:check`)
   
   The sytle checks & corrections can be simplified using 
[spotless](https://github.com/diffplug/spotless/tree/master/plugin-maven) 
plugin.
   Should I create a separate PR to implement spotless plugin for auto style 
correction?
   


-- 
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: 603782)
Time Spent: 2h 20m  (was: 2h 10m)

> 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: 2h 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603781=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603781
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 29/May/21 02:38
Start Date: 29/May/21 02:38
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850755188


   thanks @XenoAmess and @kinow 
   Fixed checkstyles issues (also checked locally using `mvn checkstyle:check`)
   
   The sytle checks & corrections can be simplified using `spotless` plugin.
   Should I create a separate PR to implement spotless plugin for auto style 
correction?
   


-- 
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: 603781)
Time Spent: 2h 10m  (was: 2h)

> 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: 2h 10m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603705=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603705
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 28/May/21 21:35
Start Date: 28/May/21 21:35
Worklog Time Spent: 10m 
  Work Description: kinow commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850688088


   > The CI flagged failing tests are not stemming from any code that I have 
touched,
   > How to resolve?
   
   Click on the link of the failed Travis CI builds. Then choose one of the JDK 
versions (e.g. 8). There you should find the logs of the job that failed. [For 
instance](https://travis-ci.com/github/apache/commons-collections/jobs/508633788):
   
   >[ERROR] 
src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[149,3]
 (indentation) Indentation: 'method def rcurly' has incorrect indentation level 
2, expected level should be 4.


-- 
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: 603705)
Time Spent: 1h 50m  (was: 1h 40m)

> 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: 1h 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603706=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603706
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 28/May/21 21:35
Start Date: 28/May/21 21:35
Worklog Time Spent: 10m 
  Work Description: kinow edited a comment on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850688088


   @anantdamle
   
   > The CI flagged failing tests are not stemming from any code that I have 
touched,
   > How to resolve?
   
   Click on the link of the failed Travis CI builds. Then choose one of the JDK 
versions (e.g. 8). There you should find the logs of the job that failed. [For 
instance](https://travis-ci.com/github/apache/commons-collections/jobs/508633788):
   
   >[ERROR] 
src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[149,3]
 (indentation) Indentation: 'method def rcurly' has incorrect indentation level 
2, expected level should be 4.


-- 
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: 603706)
Time Spent: 2h  (was: 1h 50m)

> 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: 2h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}
>  
> Another convenience could be to use an Iterable for easy for-each constructs.
> {code:java}
> List studentIds = ...
> List studentNames = ...
> for (PairedItem 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)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=603513=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603513
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 28/May/21 13:26
Start Date: 28/May/21 13:26
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-850417839


   > The CI flagged failing tests are not stemming from any code that I have 
touched,
   > How to resolve?
   
   checkstyles fails.
   
   
   https://travis-ci.com/github/apache/commons-collections/jobs/508633787
   
   [ERROR] 
src/main/java/org/apache/commons/collections4/IterableUtils.java:[574,21] 
(whitespace) WhitespaceAfter: ',' is not followed by whitespace.
   [ERROR] 
src/main/java/org/apache/commons/collections4/IterableUtils.java:[574,46] 
(whitespace) WhitespaceAfter: ',' is not followed by whitespace.
   [ERROR] 
src/main/java/org/apache/commons/collections4/IterableUtils.java:[578,47] 
(whitespace) WhitespaceAfter: ',' is not followed by whitespace.
   [ERROR] 
src/main/java/org/apache/commons/collections4/IterableUtils.java:[580,41] 
(whitespace) WhitespaceAfter: ',' is not followed by whitespace.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[74,7]
 (indentation) Indentation: 'ctor def' child has incorrect indentation level 6, 
expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[75,7]
 (indentation) Indentation: 'ctor def' child has incorrect indentation level 6, 
expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[88,7]
 (indentation) Indentation: 'method def' child has incorrect indentation level 
6, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[101,7]
 (indentation) Indentation: 'method def' child has incorrect indentation level 
6, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[114,7]
 (indentation) Indentation: 'method def' child has incorrect indentation level 
6, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[125,7]
 (indentation) Indentation: 'if' has incorrect indentation level 6, expected 
level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[126,9]
 (indentation) Indentation: 'if' child has incorrect indentation level 8, 
expected level should be 12.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[127,7]
 (indentation) Indentation: 'if rcurly' has incorrect indentation level 6, 
expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[129,7]
 (indentation) Indentation: 'method def' child has incorrect indentation level 
6, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[140,5]
 (indentation) Indentation: 'member def modifier' has incorrect indentation 
level 4, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[142,5]
 (indentation) Indentation: 'member def modifier' has incorrect indentation 
level 4, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[144,5]
 (indentation) Indentation: 'ctor def modifier' has incorrect indentation level 
4, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[145,7]
 (indentation) Indentation: 'ctor def' child has incorrect indentation level 6, 
expected level should be 12.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[146,7]
 (indentation) Indentation: 'ctor def' child has incorrect indentation level 6, 
expected level should be 12.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[147,5]
 (indentation) Indentation: 'ctor def rcurly' has incorrect indentation level 
4, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[156,5]
 (indentation) Indentation: 'method def modifier' has incorrect indentation 
level 4, expected level should be 8.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[157,7]
 (indentation) Indentation: 'method def' child has incorrect indentation level 
6, expected level should be 12.
   [ERROR] 
src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[158,5]
 (indentation) 

[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-27 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602931=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602931
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 27/May/21 12:23
Start Date: 27/May/21 12:23
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#issuecomment-849587019


   The CI flagged failing tests are not stemming from any code that I have 
touched, 
   How to resolve?


-- 
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: 602931)
Time Spent: 1.5h  (was: 1h 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: 1.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-27 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602928=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602928
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 27/May/21 12:20
Start Date: 27/May/21 12:20
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r640568855



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
##
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   ZippedTupleIterator> zippedIterator =
+ * ZippedTupleIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (zippedIterator.hasNext()) {
+ * ZippedTuple item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class ZippedTupleIterator implements Iterator> {

Review comment:
   Updated to use `PairedIterator` and `PairedIterable` names. Hope is 
acceptable to all.




-- 
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: 602928)
Time Spent: 1h 20m  (was: 1h 10m)

> 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: 1h 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-27 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602927=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602927
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 27/May/21 12:19
Start Date: 27/May/21 12:19
Worklog Time Spent: 10m 
  Work Description: anantdamle commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r640568393



##
File path: 
src/test/java/org/apache/commons/collections4/iterators/ZippedTupleIteratorTest.java
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.commons.collections4.IteratorUtils;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+
+/** Unit test suite for {@link ZippingIterator}. */
+public final class ZippedTupleIteratorTest
+extends AbstractIteratorTest> {
+
+  // Conventional
+
+  public ZippedTupleIteratorTest(String testName) {
+super(testName);
+  }
+
+  // Lifecycle
+
+  private ArrayList smallStringsList = null;
+  private ArrayList largeStringsList = null;
+  private ArrayList smallIntsList = null;
+  private ArrayList largeIntsList = null;
+
+  // Unequal sized lists
+  private static final int SMALL_LIST_SIZE = 20;
+  private static final int LARGE_LIST_SIZE = 40;
+
+  @Override
+  protected void setUp() throws Exception {
+super.setUp();
+
+smallStringsList = new ArrayList<>();
+largeStringsList = new ArrayList<>();
+smallIntsList = new ArrayList<>();
+largeIntsList = new ArrayList<>();
+
+Random random = new Random();
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  smallIntsList.add(random.nextInt());
+  smallStringsList.add(UUID.randomUUID().toString());
+}
+
+for (int i = 0; i < LARGE_LIST_SIZE; i++) {
+  largeIntsList.add(random.nextInt());
+  largeStringsList.add(UUID.randomUUID().toString());
+}
+  }
+
+  @Override
+  public boolean supportsRemove() {
+return false;
+  }
+
+  // TestIterator Methods
+
+  @Override
+  public Iterator> makeEmptyIterator() {
+return ZippedTupleIterator.of(IteratorUtils.emptyIterator(), 
IteratorUtils.emptyIterator());
+  }
+
+  @Override
+  public Iterator> makeObject() {
+return ZippedTupleIterator.of(smallStringsList.iterator(), 
smallIntsList.iterator());
+  }
+
+  public void testLeftIteratorLargerThanRight() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.ofIterables(largeStringsList, smallIntsList);
+
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  assertTrue(zipPairIterator.hasNext());
+  ZippedTuple zippedItem = zipPairIterator.next();
+
+  assertEquals(largeStringsList.get(i) , zippedItem.getLeftItem());
+  assertEquals(smallIntsList.get(i) , zippedItem.getRightItem());
+}
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testRightIteratorLargerThanLeft() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.ofIterables(smallStringsList, largeIntsList);
+
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  assertTrue(zipPairIterator.hasNext());
+  ZippedTuple zippedItem = zipPairIterator.next();
+
+  assertEquals(smallStringsList.get(i) , zippedItem.getLeftItem());
+  assertEquals(largeIntsList.get(i) , zippedItem.getRightItem());
+}
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testEmptyLeftIterator() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.of(IteratorUtils.emptyIterator(), 
largeIntsList.iterator());
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testEmptyRightIterator() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.of(largeStringsList.iterator(), 

Re: [jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread Chaitanya K
unsubscribe

On Wed, May 26, 2021 at 11:56 AM ASF GitHub Bot (Jira) 
wrote:

>
>  [
> https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602494=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602494
> ]
>
> ASF GitHub Bot logged work on COLLECTIONS-795:
> --
>
> Author: ASF GitHub Bot
> Created on: 26/May/21 18:55
> Start Date: 26/May/21 18:55
> 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_r640040301
>
>
>
> ##
> File path:
> src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
> ##
> @@ -0,0 +1,176 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *  http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.apache.commons.collections4.iterators;
> +
> +import static java.util.Objects.requireNonNull;
> +
> +import java.util.Iterator;
> +import java.util.NoSuchElementException;
> +import
> org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
> +
> +/**
> + * Provides a iteration over the elements contained in a pair of
> Iterators.
> + *
> + * 
> + * Given two {@link Iterator} instances {@code A} and {@code B}, the
> {@link #next} method on this
> + * iterator provide a Pair of {@code A.next()} and {@code B.next()} until
> one of the iterators is
> + * exhausted.
> + * 
> + * Example usage:
> + * {@code
> + *   List studentIds = ...
> + *   List studentNames = ...
> + *
> + *   ZippedTupleIterator> zippedIterator =
> + * ZippedTupleIterator.ofIterables(studentIds, studentNames);
> + *
> + *   while (zippedIterator.hasNext()) {
> + * ZippedTuple item = zippedIterator.next();
> + * ...
> + *   }
> + * }
> + *
> + * @param  the left elements' type
> + * @param  the right elements' type
> + */
> +public class ZippedTupleIterator implements Iterator R>> {
>
> Review comment:
>Why is this prefixed with "zip" when it has nothing to do with zip
> files?
>
>
>
>
> --
> 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: 602494)
> Time Spent: 20m  (was: 10m)
>
> > 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: 20m
> >  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 leftIterator =  ...;
> > Iterator rightIterator = ...;
> > PairIterator pairIterator = PairIterator.of(leftIterator,
> rightIterator);
> > while (pairIterator.hasNext()) {
> >ImmutablePair item = pairIterator.next();
> >...
> > }{code}
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602591=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602591
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 21:42
Start Date: 26/May/21 21:42
Worklog Time Spent: 10m 
  Work Description: kinow commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r640141352



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
##
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   ZippedTupleIterator> zippedIterator =
+ * ZippedTupleIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (zippedIterator.hasNext()) {
+ * ZippedTuple item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class ZippedTupleIterator implements Iterator> {

Review comment:
   I'm not good naming things, so can't really suggest a better one. The 
code example in the Python docs uses `zipped` too for the variable that 
contains the tuples returned with `zip` (that were zipped), so that should 
sound OK for users coming from Python (or JS using Lodash's 
[zip/unzip](https://lodash.com/docs/#unzip) which I'm using in my current 
project). But if that's confusing for other users, we can try to think in a 
better name I think.




-- 
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: 602591)
Time Spent: 1h  (was: 50m)

> 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: 1h
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602583=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602583
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 21:29
Start Date: 26/May/21 21:29
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_r640134632



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
##
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   ZippedTupleIterator> zippedIterator =
+ * ZippedTupleIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (zippedIterator.hasNext()) {
+ * ZippedTuple item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class ZippedTupleIterator implements Iterator> {

Review comment:
   Maybe but the prefix here is "zipped" not "zipper", terrible name IMO.




-- 
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: 602583)
Time Spent: 50m  (was: 40m)

> 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: 50m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602563=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602563
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 20:46
Start Date: 26/May/21 20:46
Worklog Time Spent: 10m 
  Work Description: kinow commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r640108528



##
File path: 
src/test/java/org/apache/commons/collections4/iterators/ZippedTupleIteratorTest.java
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.commons.collections4.IteratorUtils;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+
+/** Unit test suite for {@link ZippingIterator}. */
+public final class ZippedTupleIteratorTest
+extends AbstractIteratorTest> {
+
+  // Conventional
+
+  public ZippedTupleIteratorTest(String testName) {
+super(testName);
+  }
+
+  // Lifecycle
+
+  private ArrayList smallStringsList = null;
+  private ArrayList largeStringsList = null;
+  private ArrayList smallIntsList = null;
+  private ArrayList largeIntsList = null;
+
+  // Unequal sized lists
+  private static final int SMALL_LIST_SIZE = 20;
+  private static final int LARGE_LIST_SIZE = 40;
+
+  @Override
+  protected void setUp() throws Exception {
+super.setUp();
+
+smallStringsList = new ArrayList<>();
+largeStringsList = new ArrayList<>();
+smallIntsList = new ArrayList<>();
+largeIntsList = new ArrayList<>();
+
+Random random = new Random();
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  smallIntsList.add(random.nextInt());
+  smallStringsList.add(UUID.randomUUID().toString());
+}
+
+for (int i = 0; i < LARGE_LIST_SIZE; i++) {
+  largeIntsList.add(random.nextInt());
+  largeStringsList.add(UUID.randomUUID().toString());
+}
+  }
+
+  @Override
+  public boolean supportsRemove() {
+return false;
+  }
+
+  // TestIterator Methods
+
+  @Override
+  public Iterator> makeEmptyIterator() {
+return ZippedTupleIterator.of(IteratorUtils.emptyIterator(), 
IteratorUtils.emptyIterator());
+  }
+
+  @Override
+  public Iterator> makeObject() {
+return ZippedTupleIterator.of(smallStringsList.iterator(), 
smallIntsList.iterator());
+  }
+
+  public void testLeftIteratorLargerThanRight() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.ofIterables(largeStringsList, smallIntsList);
+
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  assertTrue(zipPairIterator.hasNext());
+  ZippedTuple zippedItem = zipPairIterator.next();
+
+  assertEquals(largeStringsList.get(i) , zippedItem.getLeftItem());
+  assertEquals(smallIntsList.get(i) , zippedItem.getRightItem());
+}
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testRightIteratorLargerThanLeft() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.ofIterables(smallStringsList, largeIntsList);
+
+
+for (int i = 0; i < SMALL_LIST_SIZE; i++) {
+  assertTrue(zipPairIterator.hasNext());
+  ZippedTuple zippedItem = zipPairIterator.next();
+
+  assertEquals(smallStringsList.get(i) , zippedItem.getLeftItem());
+  assertEquals(largeIntsList.get(i) , zippedItem.getRightItem());
+}
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testEmptyLeftIterator() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.of(IteratorUtils.emptyIterator(), 
largeIntsList.iterator());
+
+assertFalse(zipPairIterator.hasNext());
+  }
+
+  public void testEmptyRightIterator() {
+Iterator> zipPairIterator =
+ZippedTupleIterator.of(largeStringsList.iterator(), 

[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602562=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602562
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 20:45
Start Date: 26/May/21 20:45
Worklog Time Spent: 10m 
  Work Description: kinow commented on a change in pull request #238:
URL: 
https://github.com/apache/commons-collections/pull/238#discussion_r640108388



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
##
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   ZippedTupleIterator> zippedIterator =
+ * ZippedTupleIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (zippedIterator.hasNext()) {
+ * ZippedTuple item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class ZippedTupleIterator implements Iterator> {

Review comment:
   I think it is related to 
[zipper](https://en.wikipedia.org/wiki/Zipper_(data_structure)). Like Python 
stdlib's [zip function](https://docs.python.org/3/library/functions.html#zip). 
Scala and Clojure also have a similar function I think.




-- 
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: 602562)
Time Spent: 0.5h  (was: 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: 0.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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602494=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602494
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 18:55
Start Date: 26/May/21 18:55
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_r640040301



##
File path: 
src/main/java/org/apache/commons/collections4/iterators/ZippedTupleIterator.java
##
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.iterators;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import 
org.apache.commons.collections4.iterators.ZippedTupleIterator.ZippedTuple;
+
+/**
+ * Provides a iteration over the elements contained in a pair of Iterators.
+ *
+ * 
+ * Given two {@link Iterator} instances {@code A} and {@code B}, the {@link 
#next} method on this
+ * iterator provide a Pair of {@code A.next()} and {@code B.next()} until one 
of the iterators is
+ * exhausted.
+ * 
+ * Example usage:
+ * {@code
+ *   List studentIds = ...
+ *   List studentNames = ...
+ *
+ *   ZippedTupleIterator> zippedIterator =
+ * ZippedTupleIterator.ofIterables(studentIds, studentNames);
+ *
+ *   while (zippedIterator.hasNext()) {
+ * ZippedTuple item = zippedIterator.next();
+ * ...
+ *   }
+ * }
+ *
+ * @param  the left elements' type
+ * @param  the right elements' type
+ */
+public class ZippedTupleIterator implements Iterator> {

Review comment:
   Why is this prefixed with "zip" when it has nothing to do with zip files?




-- 
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: 602494)
Time Spent: 20m  (was: 10m)

> 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: 20m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COLLECTIONS-795) provide a PairIterator to zip two iterators of different types.

2021-05-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-795?focusedWorklogId=602460=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-602460
 ]

ASF GitHub Bot logged work on COLLECTIONS-795:
--

Author: ASF GitHub Bot
Created on: 26/May/21 17:53
Start Date: 26/May/21 17:53
Worklog Time Spent: 10m 
  Work Description: anantdamle opened a new pull request #238:
URL: https://github.com/apache/commons-collections/pull/238


   [COLLECTIONS-795] Add a new Iterator to allowing zipping over two iterators 
of different types.


-- 
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: 602460)
Remaining Estimate: 0h
Time Spent: 10m

> 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: 10m
>  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 leftIterator =  ...;
> Iterator rightIterator = ...;
> PairIterator pairIterator = PairIterator.of(leftIterator, rightIterator);
> while (pairIterator.hasNext()) {
>ImmutablePair item = pairIterator.next();
>...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)