Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 326 commits into from

Conversation

anantdamle
Copy link

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

* @param <L> the left elements' type
* @param <R> the right elements' type
*/
public class ZippedTupleIterator<L, R> implements Iterator<ZippedTuple<L, R>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is related to zipper. Like Python stdlib's zip function. Scala and Clojure also have a similar function I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use PairedIterator and PairedIterable names. Hope is acceptable to all.

@anantdamle
Copy link
Author

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

@XenoAmess
Copy link
Contributor

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) Indentation: 'method def rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[160,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:[161,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:[162,5] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[164,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:[165,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:[166,5] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[168,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:[170,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:[171,5] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/main/java/org/apache/commons/collections4/iterators/PairedIterator.java:[172,3] (indentation) Indentation: 'class def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/main/java/org/apache/commons/collections4/IteratorUtils.java:[921,21] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/collections4/IteratorUtils.java:[921,41] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/collections4/PairedIterable.java:[85,21] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/collections4/PairedIterable.java:[85,41] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/collections4/PairedIterable.java:[97,31] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/PairedIterableTest.java:[64,9] (whitespace) WhitespaceAfter: 'for' is not followed by whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[33,3] (indentation) Indentation: 'ctor def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[34,5] (indentation) Indentation: 'ctor def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[35,3] (indentation) Indentation: 'ctor def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[39,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[40,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[41,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[42,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[45,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[46,3] (indentation) Indentation: 'member def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[48,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[50,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[52,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[53,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[54,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[55,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[57,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[59,5] (indentation) Indentation: 'for' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[60,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[61,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[62,5] (indentation) Indentation: 'for rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[64,5] (indentation) Indentation: 'for' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[65,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[66,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[67,5] (indentation) Indentation: 'for rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[68,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[70,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[72,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[73,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[77,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[79,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[80,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[82,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[84,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[85,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[87,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[88,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[92,5] (indentation) Indentation: 'for' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[93,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[94,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[96,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[96,44] (whitespace) NoWhitespaceBefore: ',' is preceded with whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[97,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[97,41] (whitespace) NoWhitespaceBefore: ',' is preceded with whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[98,5] (indentation) Indentation: 'for rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[100,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[101,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[103,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[104,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[108,5] (indentation) Indentation: 'for' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[109,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[110,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[112,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[112,44] (whitespace) NoWhitespaceBefore: ',' is preceded with whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[113,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[113,41] (whitespace) NoWhitespaceBefore: ',' is preceded with whitespace.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[114,5] (indentation) Indentation: 'for rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[116,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[117,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[119,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[120,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[123,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[124,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[126,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[127,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[130,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[131,3] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[134,3] (indentation) Indentation: 'method def modifier' has incorrect indentation level 2, expected level should be 4.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[135,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[139,5] (indentation) Indentation: 'for' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[140,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[141,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[143,7] (indentation) Indentation: 'for' child has incorrect indentation level 6, expected level should be 12.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[146,5] (indentation) Indentation: 'for rcurly' has incorrect indentation level 4, expected level should be 8.
[ERROR] src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java:[148,5] (indentation) Indentation: 'method def' child has incorrect indentation level 4, expected level should be 8.
[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.

@kinow
Copy link
Member

kinow commented May 28, 2021

@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:

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

@anantdamle
Copy link
Author

anantdamle commented May 29, 2021

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?

@coveralls
Copy link

coveralls commented May 29, 2021

Coverage Status

Coverage decreased (-0.008%) to 90.134% when pulling 1ed50ce on anantdamle:collections_795 into 0f54cb2 on apache:master.

@anantdamle
Copy link
Author

Added tests to improve coverage

@anantdamle
Copy link
Author

What are the next steps?

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to take a look again later this week but did I miss something or are there no tests for empty lists, lists of unequal sizes, null inputs?

*
* @param <L> the left elements' type
* @param <R> the right elements' type
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to think about this because Common Lang already defines different kinds of Pair classes...

Copy link
Author

@anantdamle anantdamle Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use ImmutablePair, but that is in apache/commons-lang3 , that is not a dependency in this project and didn't think should add, but open to ideas. If you point me to a Pair Class, would be open to using an existing pair class.

private ArrayList<Integer> largeIntsList = null;

// Unequal sized lists
private static final int SMALL_LIST_SIZE = 20;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you expect the sizes to be different, you should assert that fact somewhere.

Copy link
Author

@anantdamle anantdamle Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi All,
See 2 minor comments. Another class to inspect is the existing ZippingIterator which should be considered for reuse; but note its different 'switching' aspect. Also, ZippingIterator will work for any number of input iterators (ZippingIterator.ZippingIterator(Iterator<? extends E>...)), not just two. So perhaps this PR should as well, which would remove the need for the pair class.

@anantdamle
Copy link
Author

anantdamle commented Jun 4, 2021

@garydgregory there is one big difference with ZippingIterator, ZippingIterator<T> allows iterating over iterators of same generic type, whereas the proposed solution (PairedIterator<L, R>) 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 .

@anantdamle
Copy link
Author

@garydgregory gentle bump up.

@anantdamle
Copy link
Author

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

@anantdamle
Copy link
Author

Gentle Bump: Any review comments or improvements

@garydgregory
Copy link
Member

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

@anantdamle
Copy link
Author

sorry to nag! Any updates?

@garydgregory
Copy link
Member

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

@garydgregory
Copy link
Member

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

@anantdamle
Copy link
Author

Any updates on this one?

garydgregory and others added 8 commits August 14, 2023 19:25
…llections (apache#301)

* [COLLECTIONS-811] Integrate Guava Testlib tests for Apache Commons Collections

* [COLLECTIONS-811] Add tests for Lists too, thanks to @ben-manes
Bumps [maven-pmd-plugin](https://github.com/apache/maven-pmd-plugin) from 3.16.0 to 3.17.0.
- [Release notes](https://github.com/apache/maven-pmd-plugin/releases)
- [Commits](apache/maven-pmd-plugin@maven-pmd-plugin-3.16.0...maven-pmd-plugin-3.17.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-pmd-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
* Fixed some unit tests

* First set with complete test cases.

* Cleaned up hasher collecton processing

* cleaned up code

* added license headers

* Refactored and cleaned up

Moved to dependency on BitMapProducer, IndexProducer and
BitCountProducer to retrieve internal representations of the data.

* Added license header.

* Updated documentation

* Fixed bug and added tests

* Added "@SInCE 4.5" where necessary

* Added BitMapProducer constructor to SimpleBloomFilter

* added BitMapProducer.fromLongArray() and Hasher.isEmpty()

* Changes to speed up Simple filter processing

* Null hasher used when a hasher is required but no values are available.

* Added Hasher.Filter and Hasher.FilteredIntConsumer

* Updated documentation + formatted.

* Added license

* fixed checkstyle issues

* fixed javadoc issues

* fixed test issue

* fixed javadoc issues

* Reduced the acceptable delta for p tests

* Updated docs and test cases

* Updated docs and test cases

* fixed issue with Shape javadoc

* Added more test coverage.

* fixed formatting issues

* Updated tests to use assertThrows.

* fixed indents

* Added constructor with IndexProducer

* Fixed issue with compare and different length bitMap arrays

* fixed formatting issues

* Efficiency changes

cleaned up asIndexArray

BitMapProducer to IndexProducer conversion

* changed XProviers to use XPredicates

* Removed NoMatchException

* Removed unneeded BitMap funcs

Moves isSparse() to Shape.

* fixed checkstyle issues

* Fixed javadoc errors

* simplified parameter in BitMapProducer.fromIndexProducer

* fixed tests

* added BitMapping verification

* Added more tests

* Added more tests

* Fixed typos

* Changes requested  by aherbert

* fixed "bit map" in documentation

* Renamed tests

* Removed blank lines

* changed new X<foo> to new X<>

* updated documentation

* Added BloomFilter.copy()

* changed ArrayCountingBloomFilter to use copy() method

* cleaned up numberOfBitsMaps()

* added asBitMapArray() and makePredicate() to BitMapProducer

* Moved asIndexArray() to IndexProducer

* harmonized Simple and Sparse Bloom filter constructors

* Implemented AbstractCountingBloomFilter.asindexArray()

* updated documentation

* fixed up NullHasher

* implemented hasher filter

* Fixed style issues

* added default SimpleHasher increment.

* Added modulus calculation to SimpleHasher

* fixed Hashing issues

* moved hasher/filter/* to /hasher

* moved bloomfilter/hasher to bloomfilter

* fixed up checkstyle issues

* Made Filter -> IndexFilter -w- factory

* moved IndexFilter into Hasher

* updated hashing tests & fixed checksyle

* removed SingleItemhasherCollection as associated methods

* Fixed some unit tests

* First set with complete test cases.

* Cleaned up hasher collecton processing

* cleaned up code

* added license headers

* Refactored and cleaned up

Moved to dependency on BitMapProducer, IndexProducer and
BitCountProducer to retrieve internal representations of the data.

* Added license header.

* Updated documentation

* Fixed bug and added tests

* Added "@SInCE 4.5" where necessary

* Added BitMapProducer constructor to SimpleBloomFilter

* added BitMapProducer.fromLongArray() and Hasher.isEmpty()

* Changes to speed up Simple filter processing

* Null hasher used when a hasher is required but no values are available.

* Added Hasher.Filter and Hasher.FilteredIntConsumer

* Updated documentation + formatted.

* Added license

* fixed checkstyle issues

* fixed javadoc issues

* fixed test issue

* fixed javadoc issues

* Reduced the acceptable delta for p tests

* Updated docs and test cases

* Updated docs and test cases

* fixed issue with Shape javadoc

* Added more test coverage.

* fixed formatting issues

* Updated tests to use assertThrows.

* fixed indents

* Added constructor with IndexProducer

* Fixed issue with compare and different length bitMap arrays

* fixed formatting issues

* Efficiency changes

cleaned up asIndexArray

BitMapProducer to IndexProducer conversion

* changed XProviers to use XPredicates

* Removed NoMatchException

* Removed unneeded BitMap funcs

Moves isSparse() to Shape.

* fixed checkstyle issues

* Fixed javadoc errors

* simplified parameter in BitMapProducer.fromIndexProducer

* fixed tests

* added BitMapping verification

* Added more tests

* Added more tests

* Fixed typos

* Changes requested  by aherbert

* fixed "bit map" in documentation

* Renamed tests

* Removed blank lines

* changed new X<foo> to new X<>

* updated documentation

* Added BloomFilter.copy()

* changed ArrayCountingBloomFilter to use copy() method

* cleaned up numberOfBitsMaps()

* added asBitMapArray() and makePredicate() to BitMapProducer

* Moved asIndexArray() to IndexProducer

* harmonized Simple and Sparse Bloom filter constructors

* Implemented AbstractCountingBloomFilter.asindexArray()

* updated documentation

* fixed up NullHasher

* implemented hasher filter

* Fixed style issues

* added default SimpleHasher increment.

* Added modulus calculation to SimpleHasher

* fixed Hashing issues

* moved hasher/filter/* to /hasher

* moved bloomfilter/hasher to bloomfilter

* fixed up checkstyle issues

* Made Filter -> IndexFilter -w- factory

* moved IndexFilter into Hasher

* updated hashing tests & fixed checksyle

* removed SingleItemhasherCollection as associated methods

* fixed javadoc issues

* fixed javadoc issues

* added checks for BitMapProducer limits and index limits

* updated tests

* added tests

* fixed checkstyle issues

* fixed formatting and test coverage

* fixed javadoc issue

* put back checkstyle.xml

* switched to forEachBitMapPair

* updated BitMap and Index array production

* fixed merge with BitMapProducer

* Cleaned up formatting

* fixed checkstyle issues

* fixed coding issues

* updated documentation

* simplified test

* removed unwanted merge files

* removed duplicate entry

* put back test that incorrectly removed

* fixed asIndexArray error

* fixed checkstyle errors

* Changes for last review
dependabot bot and others added 26 commits August 14, 2023 19:26
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](ossf/scorecard-action@80e868c...08b4669)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [guava-testlib](https://github.com/google/guava) from 32.0.1-jre to 32.1.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava-testlib
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [guava-testlib](https://github.com/google/guava) from 32.1.0-jre to 32.1.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava-testlib
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Passes locally, fails on GHA
* Make AbstractPatriciaTrie public

* Added javadocs
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v3.11.0...v3.12.0)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ache#411)

Bumps [com.google.guava:guava-testlib](https://github.com/google/guava) from 32.1.1-jre to 32.1.2-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava-testlib
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
apache#404, apache#405, apache#441. Bump com.google.guava:guava-testlib from 32.1.1-jre to 32.1.2-jre apache#411
…s_795

# Conflicts:
#	src/test/java/org/apache/commons/collections4/iterators/PairedIteratorTest.java
@anantdamle
Copy link
Author

Closing this as rebase to master created 100s of commits polluting the PR.
Created a fresh PR #412 with updates to Junit5

@anantdamle anantdamle closed this Aug 14, 2023
@anantdamle anantdamle deleted the collections_795 branch August 14, 2023 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet