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
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
afa8fe8
Use java.lang.Objects#equals; eliminate a couple of nulls #307
garydgregory Jun 6, 2022
8aa1cd4
Replace JUnit 3/4 @Ignore with JUnit 5 @Disabled
garydgregory Jun 6, 2022
2a6308e
[COLLECTIONS-811] Integrate Guava Testlib tests for Apache Commons Co…
kinow Jun 6, 2022
61d87b9
Bump actions/cache from 3.0.3 to 3.0.4
garydgregory Jun 7, 2022
d814fc1
Bump maven-pmd-plugin from 3.16.0 to 3.17.0
dependabot[bot] Jun 10, 2022
cf3fb3d
Remove obsolete Maven profile
garydgregory Jun 13, 2022
a22a2b9
Fix and update site build (except jdepend/site broken compatibility)
garydgregory Jun 13, 2022
4e36ad9
Simplify bloom filters (#258)
Claudenw Jun 15, 2022
86e5f7c
Move counting long predicate (#314)
Claudenw Jun 25, 2022
0096325
Bump commons.pmd-impl.version from 6.46.0 to 6.47.0
dependabot[bot] Jul 1, 2022
e306c67
Add missing namespace and XSD to SpotBugs filter file.
garydgregory Jul 4, 2022
b7bcfcf
Add missing namespace and XSD to SpotBugs filter file.
garydgregory Jul 4, 2022
a2b0fb7
COLLECTIONS-823: Modified ArrayCountingBloomFilter.forEachBitMap to b…
Claudenw Jul 5, 2022
194c16c
moved ArrayTracker and BitMapTracker to their own files.
Claudenw Jun 29, 2022
50c9a89
Added new lines at end of files
Claudenw Jun 29, 2022
b723a52
put IndexFilter in separate file.
Claudenw Jun 29, 2022
c9c0692
added missing license
Claudenw Jun 29, 2022
6b060af
fixed checkstyle issues
Claudenw Jun 29, 2022
3c2f9c9
removed bad import
Claudenw Jun 29, 2022
f44bab8
Made IndexFilter.create() return an IntPredicate
Claudenw Jul 6, 2022
0a21aab
removed unused imports
Claudenw Jul 6, 2022
2824b3d
Use for-each loop
garydgregory Jul 9, 2022
f5256e4
Bump actions/cache 3.0.4 to 3.0.5
garydgregory Jul 15, 2022
e7b92dc
replaced merge with old mergeInPlace
Claudenw Jun 24, 2022
056c6f4
removed files added in error
Claudenw Jun 28, 2022
7b4ea05
Bump commons.junit.version from 5.8.2 to 5.9.0 (#324)
dependabot[bot] Jul 29, 2022
88147b1
Bump commons.junit.version from 5.8.2 to 5.9.0 #324
garydgregory Jul 29, 2022
e452ee9
Update GitHub builds to use Temurin
garydgregory Jul 29, 2022
f4d9058
Bump actions/cache from 3.0.5 to 3.0.6
garydgregory Aug 5, 2022
eddbd00
Bump actions/cache from 3.0.5 to 3.0.6
garydgregory Aug 5, 2022
4bc40e5
Bump commons.pmd-impl.version from 6.47.0 to 6.48.0
dependabot[bot] Aug 5, 2022
2b03765
Collections-824: Optimize SimpleHasher.forEachIndex and SimpleHasher …
Claudenw Aug 8, 2022
55528c5
Collections 827: Add tests using or, and and xor with different lengt…
Claudenw Aug 10, 2022
731c42f
Bump actions/cache from 3.0.6 to 3.0.7
garydgregory Aug 12, 2022
05ec896
Collections-818: convert to characteristics flag (#329)
Claudenw Aug 16, 2022
f767cfd
Bump actions/cache from 3.0.7 to 3.0.8
garydgregory Aug 22, 2022
403aeaf
COLLECTIONS-831: Add BloomFilter clear() method
Claudenw Aug 23, 2022
f4ae48f
Test code cleanup
aherbert Aug 23, 2022
134303e
Removed obsolete file
aherbert Aug 23, 2022
4c410fb
[COLLECTIONS-833] Intermittent failure in EmptyPropertiesTest
garydgregory Aug 24, 2022
3c7a225
Bump maven-pmd-plugin from 3.17.0 to 3.18.0
garydgregory Aug 24, 2022
333a2e9
Bump maven-checkstyle-plugin 3.1.0 to 3.2.0.
garydgregory Aug 24, 2022
03f9f6d
Update README to use the default Maven goal
garydgregory Aug 26, 2022
426a289
Use diamond operator
aherbert Aug 24, 2022
0f701b7
Use private inner class
aherbert Aug 24, 2022
9eb8e43
Add CodeQL badge
garydgregory Aug 27, 2022
0118753
Fix typo independant -> independent
garydgregory Aug 28, 2022
6720909
Javadoc @see tags do not need to use a FQCN for classes in java.lang
garydgregory Aug 29, 2022
1538214
Javadoc @link tags do not need to use a FQCN for classes in java.lang
garydgregory Aug 29, 2022
a14e1e5
Formatting
aherbert Aug 30, 2022
6e06ecd
Update code coverage badge and link
garydgregory Aug 30, 2022
d8938a7
Refer to master branch only and drop reference to trunk branch name
garydgregory Sep 1, 2022
db8c7d6
Use GAV coordinates Maven Central coordinates to make sure to pick up
garydgregory Sep 1, 2022
54ef3fa
Rename type parameter
garydgregory Sep 1, 2022
44cb1f5
Bump commons.pmd-impl.version from 6.48.0 to 6.49.0 (#333)
dependabot[bot] Sep 2, 2022
5ea10a0
Bump commons.pmd-impl.version from 6.48.0 to 6.49.0 #333
garydgregory Sep 2, 2022
46e7ea9
Bump actions/checkout from 3 to 3.0.2.
garydgregory Sep 6, 2022
964695a
Bump maven-pmd-plugin from 3.18.0 to 3.19.0
dependabot[bot] Sep 9, 2022
ac30e1b
Collections-763: Remove BloomFilter constructors that create initial …
Claudenw Sep 9, 2022
4d214b5
Fix typo
aherbert Sep 9, 2022
98ce7ff
Simplify random indices tests
aherbert Sep 9, 2022
a294c35
Update IndexProducerTest to test the behaviour
aherbert Sep 10, 2022
28078f7
Add same scorecards-analysis.yml as Apache Log4j (except for branches)
garydgregory Sep 12, 2022
f88867c
Add ossf/scorecard-action badge to readme
garydgregory Sep 14, 2022
c0a5ba3
Use GitHub cache for CodeQL
garydgregory Sep 22, 2022
34c11c3
Bump commons.junit.version from 5.9.0 to 5.9.1 (#338)
dependabot[bot] Sep 22, 2022
076f8ee
Bump commons.junit.version from 5.9.0 to 5.9.1 #338
garydgregory Sep 22, 2022
f88644c
Bump commons-parent from 53 to 54 (#339)
dependabot[bot] Sep 22, 2022
33aa9d1
Bump commons-parent from 53 to 54 #339
garydgregory Sep 22, 2022
663cf79
Fix flaky test failure in SynchronizedBagTest#testCollectionToArray2
Partha-SUST16 Sep 23, 2022
40fc4d1
Update test of unordered arrays
aherbert Sep 23, 2022
08c3e11
Track changes
aherbert Sep 23, 2022
0fe27a2
Drop Clirr property since commons-parent has replaced Clirr with
garydgregory Sep 23, 2022
0d20bfa
Pick up Apache RAT 0.15 from commons-parent
garydgregory Sep 23, 2022
1a21f3e
Bump japicmp-maven-plugin from 0.15.7 to 0.16.0
garydgregory Sep 24, 2022
d1e2412
Doc: Bump commons-parent from 53 to 54
garydgregory Sep 24, 2022
1dc2d9c
Replace Travis-CI badge with GitHub Actions CI
garydgregory Sep 29, 2022
24b8b2c
Bump actions/cache from 3.0.8 to 3.0.9 (#342)
dependabot[bot] Sep 30, 2022
a6355c2
Bump actions/cache from 3.0.8 to 3.0.9 #342
garydgregory Sep 30, 2022
2ea29ab
Bump actions/setup-java from 3 to 3.5.1
garydgregory Oct 1, 2022
673da2f
Fix flaky test failure in 'AbstractCollectionTest.testCollectionToArr…
Partha-SUST16 Oct 3, 2022
df2bfae
GitHub Actions build: no top level permission defined
garydgregory Oct 6, 2022
b1b8c65
Set to level permissions to 'read'
garydgregory Oct 8, 2022
604c9bd
Bump actions/cache from 3.0.9 to 3.0.10
dependabot[bot] Oct 7, 2022
6dbf920
Bump commons.pmd-impl.version from 6.49.0 to 6.50.0
dependabot[bot] Oct 7, 2022
99bea64
Bump actions/checkout from 3.0.2 to 3.1.0
dependabot[bot] Oct 7, 2022
59c73fd
Don't persist credentials unnecessarily
sebbASF Oct 8, 2022
337e931
Bump actions/cache from 3.0.10 to 3.0.11 (#348)
dependabot[bot] Oct 14, 2022
2e60e13
[COLLECTIONS-835] Fix links in javadoc and documentations
marcwrobel Aug 25, 2022
d524cf0
[COLLECTIONS-835] Add change log and credit
kinow Oct 19, 2022
5283d38
[COLLECTIONS-814] CollectionUtils.removeAll() not throwing proper Nul…
angusdev Sep 24, 2022
d103b64
[COLLECTIONS-814] Add change log
kinow Oct 19, 2022
48ebe7f
Bump actions/setup-java from 3.5.1 to 3.6.0
dependabot[bot] Oct 21, 2022
2ab32ce
Bump easymock from 4.3 to 5.0.0 (#352)
dependabot[bot] Oct 21, 2022
26168e5
Bump easymock from 4.3 to 5.0.0 #352
garydgregory Oct 21, 2022
392c8cc
Bump Scorecards from 1 to 2
garydgregory Oct 23, 2022
9278b83
Bump easymock from 5.0.0 to 5.0.1
dependabot[bot] Oct 28, 2022
5bdd36e
Bump pmd from 6.50.0 to 6.51.0
garydgregory Oct 30, 2022
bdc488c
Bump actions/upload-artifact from 3.1.0 to 3.1.1 (#354)
dependabot[bot] Nov 1, 2022
cbb3877
Remove junit version managed in commons parent via junit BOM
aherbert Nov 4, 2022
5ba3c3a
Remove junit-vintage-engine dependency
aherbert Nov 4, 2022
0221d15
Make Hasher test classes package-private
aherbert Nov 4, 2022
f5b3dd7
COLLECTIONS-836: fix flaky test DualHashBidiMapTest (#353)
anantdahiya8 Nov 5, 2022
9b93933
Track changes
aherbert Nov 5, 2022
3034107
Remove Comparable from the Shape class
aherbert Nov 5, 2022
39bd0d9
Collections-834: Clarify Bloom filter BitCountProducer operation (#335)
Claudenw Nov 5, 2022
36b56e7
Bloom filter code clean-up
aherbert Nov 5, 2022
7434b20
Fixed typos originally reported in pull #323 (#349)
Claudenw Nov 6, 2022
bf9fc25
(chore) Fix minor typos (#323)
marcwrobel Nov 6, 2022
c07500f
Fix minor typos #323
garydgregory Nov 6, 2022
687480d
Add @SuppressWarnings and tweak formatting
garydgregory Nov 6, 2022
eefba11
Add missing @Override
garydgregory Nov 6, 2022
5186ccb
Simpler lambdas
garydgregory Nov 6, 2022
fbb34d3
Use Java 5 for each loop
garydgregory Nov 6, 2022
bf230c3
Use lambdas
garydgregory Nov 6, 2022
490b6af
Call to super is redundant
garydgregory Nov 6, 2022
fef5a26
These test classes can be static
garydgregory Nov 6, 2022
970a09f
PMD: Use direct access
garydgregory Nov 6, 2022
955352e
Simplify ignorance of caught exception
garydgregory Nov 6, 2022
e360f3b
PMD: Use direct access
garydgregory Nov 6, 2022
1845fe8
PMD: No need to nest
garydgregory Nov 6, 2022
a023de1
PMD: AbstractReferenceMap.SoftRef implements hashCode() but not equals()
garydgregory Nov 6, 2022
659b840
PMD: AbstractReferenceMap.WeakRef implements hashCode() but not equals()
garydgregory Nov 6, 2022
5b12651
Javadoc
garydgregory Nov 6, 2022
ebae8a3
Remove unnecessary parens
garydgregory Nov 6, 2022
0496277
Enable PMD check
garydgregory Nov 6, 2022
7170bf8
Format tweak
garydgregory Nov 6, 2022
f9333ca
Javadocs and comments
garydgregory Nov 7, 2022
7c848e3
Use method reference
aherbert Nov 7, 2022
6024a71
Whitespace formatting
aherbert Nov 9, 2022
2b8301e
Collections-837: Remove HasherCollection
Claudenw Nov 12, 2022
31de544
Fix flaky test in CollectionUtilsTest (#360)
yannizhou05 Nov 15, 2022
067fedd
Add GHitHub robots file
garydgregory Nov 19, 2022
0a7395c
Bump pmd from 6.51.0 to 6.52.0
garydgregory Nov 26, 2022
3cb83a8
Sort imports
garydgregory Nov 25, 2022
981de22
Reuse constants
garydgregory Nov 25, 2022
297ae00
Inherit PMD plugin configuration of PMD from parent POM
garydgregory Nov 26, 2022
19ed3d4
Use Java style array decelerations (#362)
arturobernalg Nov 26, 2022
9c16067
Update changes.xml
garydgregory Nov 26, 2022
11577d0
Collections-817: Update estimateN, estimateIntersection and
Claudenw Nov 30, 2022
0cdae4d
Javadoc comment typo
aherbert Nov 30, 2022
efc1065
Remove empty line
aherbert Nov 30, 2022
1c87346
Remove public keyword from package level test members
aherbert Nov 30, 2022
8bfe546
Collections-817: Update estimateN, estimateIntersection and
aherbert Nov 30, 2022
32c6677
Bump actions/setup-java from 3.6.0 to 3.7.0 #126
garydgregory Dec 2, 2022
9ca64a9
Undo Bump actions/setup-java from 3.6.0 to 3.7.0
garydgregory Dec 6, 2022
8bc78fb
Bump actions/setup-java from 3.6.0 to 3.8.0 (#364)
dependabot[bot] Dec 9, 2022
090aa99
Bump actions/checkout from 3.1.0 to 3.2.0 (#365)
dependabot[bot] Dec 16, 2022
dd80f9d
Bump ossf/scorecard-action from 2.0.6 to 2.1.0 (#366)
dependabot[bot] Dec 16, 2022
065a09f
Bump actions/setup-java from 3.8.0 to 3.9.0
dependabot[bot] Dec 16, 2022
ea89e40
Bump commons-parent from 54 to 55 (#368)
dependabot[bot] Dec 16, 2022
1527ca8
Bump commons-parent from 54 to 55 #368
garydgregory Dec 16, 2022
0b3529c
Bump ossf/scorecard-action from 2.1.0 to 2.1.2 (#369)
dependabot[bot] Dec 23, 2022
a9f5c7f
Bump actions/cache from 3.0.11 to 3.2.1 (#370)
dependabot[bot] Dec 23, 2022
ad16709
COLLECTIONS-806: Remove use of JUnit4 junit.framework.Test class (#371)
pas725 Dec 27, 2022
3ae2668
Remove use of JUnit4 junit.framework.Test class #371
garydgregory Dec 27, 2022
70f14fc
Use Arrays.copyOf()
garydgregory Dec 28, 2022
d673b06
Bump actions/cache from 3.2.1 to 3.2.2 (#372)
dependabot[bot] Dec 30, 2022
c31bf9c
Update NOTICE to 2023
garydgregory Jan 3, 2023
dbab6e2
Bump commons-parent from 55 to 56 (#373)
dependabot[bot] Jan 3, 2023
126185e
Bump commons-parent from 55 to 56 #373
garydgregory Jan 3, 2023
1340b16
Bump easymock from 5.0.1 to 5.1.0 (#375)
dependabot[bot] Jan 3, 2023
b25f1a4
Bump easymock from 5.0.1 to 5.1.0 #375
garydgregory Jan 3, 2023
e136aa3
Bump actions/checkout from 3.2.0 to 3.3.0 (#376)
dependabot[bot] Jan 6, 2023
22a6b59
Pick up JUnit version from parent POM
garydgregory Jan 10, 2023
da1083e
Pick up JaCoCo version from parent POM
garydgregory Jan 10, 2023
d80a5a7
Pick up maven-pmd-plugin version from parent POM
garydgregory Jan 10, 2023
14234ba
Pick up japicmp-maven-plugin version from parent POM
garydgregory Jan 10, 2023
c1cae17
Pick up pmd version from parent POM
garydgregory Jan 10, 2023
78863e3
Bump actions/cache from 3.2.2 to 3.2.3 (#377)
dependabot[bot] Jan 13, 2023
791cf80
Bump actions/upload-artifact from 3.1.1 to 3.1.2 (#378)
dependabot[bot] Jan 13, 2023
10b1292
Pick up maven-checkstyle-plugin version from parent
garydgregory Jan 13, 2023
7996552
Javadoc fixes
garydgregory Jan 13, 2023
fe239b9
Bump maven-checkstyle-plugin from 3.2.0 to 3.2.1
dependabot[bot] Jan 13, 2023
e82c795
Pick up maven-checkstyle-plugin version from parent
garydgregory Jan 13, 2023
64d8c65
POM project name should contain "Apache" prefix
garydgregory Jan 15, 2023
8363328
Fix typos
garydgregory Jan 15, 2023
19775dc
Fix spelling
garydgregory Jan 18, 2023
ed39e80
Add homepage and standard notifications
sebbASF Jan 20, 2023
5cbf81a
Pick up Checkstyle version from parent POM
garydgregory Feb 3, 2023
4e70a00
codecov-commenter => notifications
sebbASF Feb 3, 2023
19edcb5
Bump actions/cache from 3.2.3 to 3.2.5
dependabot[bot] Feb 10, 2023
94f0514
Bump actions/setup-java from 3.9.0 to 3.10.0
dependabot[bot] Feb 10, 2023
3e8bc92
Remove unused
garydgregory Feb 10, 2023
59f4fa3
Bump actions/cache from 3.2.5 to 3.2.6 (#383)
dependabot[bot] Feb 24, 2023
cc1f04b
Bump actions/cache from 3.2.6 to 3.3.0
dependabot[bot] Mar 10, 2023
7797a45
Use XSD
garydgregory Mar 13, 2023
f2c8b42
Javadoc
garydgregory Mar 13, 2023
ea1c58e
Bump actions/checkout from 3.3.0 to 3.4.0
dependabot[bot] Mar 17, 2023
3fce696
Bump actions/cache from 3.3.0 to 3.3.1 (#386)
dependabot[bot] Mar 17, 2023
548c445
Bump actions/checkout from 3.4.0 to 3.5.0
dependabot[bot] Mar 24, 2023
7af91ee
Javadoc: Remove extra "whitespace"
garydgregory Mar 25, 2023
68e3ff1
Javadoc/Comments: Remove extra "whitespace"
garydgregory Mar 25, 2023
5acb65c
Bump actions/setup-java from 3.10.0 to 3.11.0 (#389)
dependabot[bot] Mar 31, 2023
00239f3
Bump ossf/scorecard-action from 2.1.2 to 2.1.3 (#388)
dependabot[bot] Mar 31, 2023
2b59ddb
Bump actions/checkout from 3.5.0 to 3.5.2
dependabot[bot] Apr 14, 2023
4cc5c37
Format: "catch(" -> "catch ("
garydgregory Apr 18, 2023
6538189
[COLLECTIONS-839] migrate all tests to use junit5 assert and BulkTest…
samabcde Apr 23, 2023
d42c87e
[COLLECTIONS-839] Migrate Map tests to JUnit 5 assertions #391
garydgregory Apr 23, 2023
b2bf4e3
Organize imports
garydgregory Apr 23, 2023
7874b21
Bump commons-parent from 56 to 57 (#393)
dependabot[bot] Apr 27, 2023
ebbd286
Bump commons-parent from 56 to 57 #393
garydgregory Apr 27, 2023
94cdbec
Bump tests from commons-io:commons-io 2.11.0 to 2.12.0
garydgregory May 17, 2023
c00e682
Javadoc typos
garydgregory May 19, 2023
638693c
Javadoc typos
garydgregory May 19, 2023
c20b777
In-line comment and messages typos
garydgregory May 19, 2023
5db2642
Grammar
garydgregory May 24, 2023
05549e0
Bump commons-parent from 57 to 58
garydgregory May 25, 2023
b912b23
Bump guava-testlib from 31.1-jre to 32.0.0-jre (#394)
dependabot[bot] Jun 2, 2023
b45ad94
Bump guava-testlib from 31.1-jre to 32.0.0-jre #394.
garydgregory Jun 2, 2023
83c8ee2
Re-categorize some entries
garydgregory Jun 2, 2023
08efcd4
Bump commons-io from 2.12.0 to 2.13.0
garydgregory Jun 7, 2023
8de9296
Bump guava-testlib from 32.0.0-jre to 32.0.1-jre (#395)
dependabot[bot] Jun 9, 2023
67cb7f7
Bump guava-testlib from 32.0.0-jre to 32.0.1-jre #395
garydgregory Jun 9, 2023
633708b
Javadoc
aherbert Jun 12, 2023
ba1e44e
Move EnhancedDoubleHasher.mod() to a public BitMap API (#396)
Claudenw Jun 13, 2023
9ac6788
Move mod tests to BitMapTest
aherbert Jun 13, 2023
bf5cefd
Update BitMap.mod javadoc
aherbert Jun 13, 2023
69f9a27
Bump actions/checkout from 3.5.2 to 3.5.3
dependabot[bot] Jun 16, 2023
c051326
Changes required to open testing to new implementations. (#398)
Claudenw Jun 20, 2023
f425667
[COLLECTIONS-841] Open up bloom filter tests - test changes to suppor…
Claudenw Jun 21, 2023
2b7f1f0
Bump commons-codec:commons-codec: from 1.15 to 1.16.0
garydgregory Jun 23, 2023
88b5e65
[StepSecurity] ci: Harden GitHub Actions (#401)
step-security-bot Jun 24, 2023
f3a18bd
[StepSecurity] ci: Harden GitHub Actions #401
garydgregory Jun 24, 2023
c6aee80
Bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#403)
dependabot[bot] Jun 30, 2023
d777afd
Bump guava-testlib from 32.0.1-jre to 32.1.0-jre (#404)
dependabot[bot] Jun 30, 2023
9fec5f4
Bump guava-testlib from 32.0.1-jre to 32.1.0-jre #404
garydgregory Jun 30, 2023
08fa869
Throw a RuntimeException subclass instead of RuntimeException
garydgregory Jul 6, 2023
37a1dc2
Throw a RuntimeException subclass instead of an Error
garydgregory Jul 6, 2023
97dfed3
Bump guava-testlib from 32.1.0-jre to 32.1.1-jre (#405)
dependabot[bot] Jul 7, 2023
fac9baa
Bump guava-testlib from 32.1.0-jre to 32.1.1-jre #405
garydgregory Jul 7, 2023
b459495
Add missing entry
garydgregory Jul 13, 2023
170a776
Add org.apache.commons.collections4.properties.OrderedProperties and
garydgregory Jul 13, 2023
46a364d
Support entrySet() and forEach()
garydgregory Jul 13, 2023
b88df81
Disable testToString for now
garydgregory Jul 13, 2023
4104913
Must override toString() for Java 17
garydgregory Jul 13, 2023
21e2208
Remove unused import
garydgregory Jul 13, 2023
782d3bb
Make AbstractPatriciaTrie public (#407)
vad0 Jul 27, 2023
c91927a
Make AbstractPatriciaTrie public #407
garydgregory Jul 27, 2023
cd33766
Bump commons-parent from 58 to 59
garydgregory Jul 28, 2023
bedb515
Bump actions/setup-java from 3.11.0 to 3.12.0 (#408)
dependabot[bot] Jul 28, 2023
6d765ac
Bump commons-lang3 from 3.12.0 to 3.13.0
garydgregory Jul 28, 2023
f12c3af
Bump commons-lang3 from 3.12.0 to 3.13.0
garydgregory Jul 28, 2023
b6e7ac2
fixes misplaced symbols in javadoc (mainly in Hasher, CountingLongPre…
mawiesne Jul 29, 2023
23ce3d3
Fix punctuation and minor Javadoc issues #409
garydgregory Jul 29, 2023
a30ac76
(doc) Fix grammatical error in Javadoc
syoon2 Aug 1, 2023
c01d3dd
Bump com.google.guava:guava-testlib from 32.1.1-jre to 32.1.2-jre (#411)
dependabot[bot] Aug 4, 2023
e7b796d
Bump guava-testlib from 31.1-jre to 32.1.2-jre #394, #395, #404…
garydgregory Aug 4, 2023
45af3cc
Fix JUNIT-5 update on master
anantdamle Aug 14, 2023
dd42aa7
Merge remote-tracking branch 'origin/collections_795' into collection…
anantdamle Aug 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/main/java/org/apache/commons/collections4/IterableUtils.java
Expand Up @@ -27,6 +27,7 @@

import org.apache.commons.collections4.functors.EqualPredicate;
import org.apache.commons.collections4.iterators.LazyIteratorChain;
import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;
import org.apache.commons.collections4.iterators.ReverseListIterator;
import org.apache.commons.collections4.iterators.UniqueFilterIterator;

Expand Down Expand Up @@ -554,6 +555,34 @@ public Iterator<E> iterator() {
};
}

/**
* Provides iteration over the elements contained in a pair of Iterables in-tandem.
* <p>
* The returned iterable has an iterator that traverses the elements in {@code a}
* and {@code b} together until one of the iterables is traversed completely.
* <p>
anantdamle marked this conversation as resolved.
Show resolved Hide resolved
* The returned iterable's iterator does NOT support {@code remove()}.
*
* @param <L> the left elements' type
* @param <R> the right elements' type
* @param left the iterable for the left side elements
* @param right the iterable for the right side elements
* @return an iterable, over the decorated iterables to traverse them together until one is
* exhausted
* @throws NullPointerException if any iterator is null
*/
anantdamle marked this conversation as resolved.
Show resolved Hide resolved
public static <L, R> Iterable<PairedItem<L, R>> pairedIterable(final Iterable<L> left, final Iterable<R> right) {
checkNotNull(left);
checkNotNull(right);

return new FluentIterable<PairedItem<L, R>>(){
@Override
public Iterator<PairedItem<L, R>> iterator() {
return IteratorUtils.pairedIterator(left.iterator(), right.iterator());
}
};
}

// Utility methods
// ----------------------------------------------------------------------

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/apache/commons/collections4/IteratorUtils.java
Expand Up @@ -53,6 +53,7 @@
import org.apache.commons.collections4.iterators.ObjectArrayIterator;
import org.apache.commons.collections4.iterators.ObjectArrayListIterator;
import org.apache.commons.collections4.iterators.ObjectGraphIterator;
import org.apache.commons.collections4.iterators.PairedIterator;
import org.apache.commons.collections4.iterators.PeekingIterator;
import org.apache.commons.collections4.iterators.PushbackIterator;
import org.apache.commons.collections4.iterators.SingletonIterator;
Expand Down Expand Up @@ -907,6 +908,20 @@ public static <E> ZippingIterator<E> zippingIterator(final Iterator<? extends E>
return new ZippingIterator<>(iterators);
}

/**
* Returns an iterator that provides the elements contained in a pair of Iterators.
*
* @param <L> the left elements' type
* @param <R> 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
anantdamle marked this conversation as resolved.
Show resolved Hide resolved
*/
public static <L, R> PairedIterator<L, R> pairedIterator(final Iterator<L> left, Iterator<R> right) {
return PairedIterator.of(left, right);
}

// Views
//-----------------------------------------------------------------------
/**
Expand Down
100 changes: 100 additions & 0 deletions src/main/java/org/apache/commons/collections4/PairedIterable.java
@@ -0,0 +1,100 @@
/*
* 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 java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.apache.commons.collections4.iterators.PairedIterator;
import org.apache.commons.collections4.iterators.PairedIterator.PairedItem;

/**
* Provides iteration over the elements contained in a pair of Iterables in-tandem.
*
* <p>
* Given two {@link Iterable} instances {@code A} and {@code B}, the {@link #iterator} method on this
* iterator provide a Pair of {@code A.next()} and {@code B.next()} until one of the iterators is
* exhausted.
* </p>
* This can simplify zipping over two iterables using the for-each construct.
* Example usage:
* <pre>{@code
* List<Integer> studentIds = ...
* List<String> studentNames = ...
*
* for (PairedItem<Integer, String> items : PairedIterable.of(studentIds, studentNames) {
* Integer studentId = item.getLeft();
* String studentName = item.getRight();
* ...
* }
* }</pre>
*
* @param <L> the left elements' type
* @param <R> the right elements' type
*/
public class PairedIterable<L, R> implements Iterable<PairedItem<L, R>> {

/**
* The left {@link Iterable}s to evaluate.
*/
private final Iterable<L> leftIterable;

/**
* The right {@link Iterable}s to evaluate.
*/
private final Iterable<R> rightIterable;

// Constructor
// ----------------------------------------------------------------------

/**
* Constructs a new {@code PairedIterable} that will provide iteration over two given iterables.
*
* @param leftIterable the iterable for the left side element.
* @param rightIterable the iterable for the right side element.
* @throws NullPointerException if either iterator is null
*/
public PairedIterable(Iterable<L> leftIterable, Iterable<R> rightIterable) {
this.leftIterable = leftIterable;
this.rightIterable = rightIterable;
}

/**
* Convenience static factory to construct the PairedIterable from provided
* {@link Iterable} sources.
*
* @param leftIterable the iterable for the left side element.
* @param rightIterable the iterable for the right side element.
* @return the Iterable to iterate over the elements derived from the provided iterables.
* @throws NullPointerException if either iterables is null
*/
public static <L, R> PairedIterable<L, R> of(Iterable<L> leftIterable, Iterable<R> rightIterable) {
return new PairedIterable<>(leftIterable, rightIterable);
}

// Iterable Methods
// -------------------------------------------------------------------

@Override
public Iterator<PairedItem<L, R>> iterator() {
return PairedIterator.ofIterables(leftIterable, rightIterable);
}

public Stream<PairedItem<L, R>> stream() {
return StreamSupport.stream(spliterator(), /*parallel=*/ false);
}
}
@@ -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.
*
* <p>
* 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.
* </p>
* Example usage:
* <pre>{@code
* List<Integer> studentIds = ...
* List<String> studentNames = ...
*
* PairedIterator<PairedItem<Integer, String>> pairedIterator =
* PairedIterator.ofIterables(studentIds, studentNames);
*
* while (pairedIterator.hasNext()) {
* PairedItem<Integer, String> item = zippedIterator.next();
* ...
* }
* }</pre>
*
* @param <L> the left elements' type
* @param <R> the right elements' type
*/
public class PairedIterator<L, R> implements Iterator<PairedItem<L, R>> {

/**
* The left {@link Iterator}s to evaluate.
*/
private final Iterator<L> leftIterator;

/**
* The right {@link Iterator}s to evaluate.
*/
private final Iterator<R> 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<L> leftIterator, Iterator<R> 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 <L, R> PairedIterator<L, R> of(Iterator<L> leftIterator, Iterator<R> 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 <L, R> PairedIterator<L, R> ofIterables(Iterable<L> leftIterable, Iterable<R> 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();
}

/**
* Returns the next elements from both the child iterators.
*
* @return the next elements from both the iterators.
* @throws NoSuchElementException if any one child iterator is exhausted.
*/
@Override
public PairedItem<L, R> next() {
if (!hasNext()) {
throw new NoSuchElementException();
}

return PairedItem.of(leftIterator.next(), rightIterator.next());
}

/**
* An immutable tuple class to represent elements from both the iterators.
*
* @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.

public static final class PairedItem<L, R> {

private final L leftItem;

private final R rightItem;

private PairedItem(L leftItem, R rightItem) {
this.leftItem = leftItem;
this.rightItem = rightItem;
}

/**
* Convenience static factory method to construct the tuple pair.
*
* @param left the left element
* @param right the right element
* @return the Immutable tuple pair of two elements.
*/
private static <L, R> PairedItem<L, R> of(L left, R right) {
return new PairedItem<>(left, right);
}

public L getLeftItem() {
return leftItem;
}

public R getRightItem() {
return rightItem;
}

@Override
public String toString() {
return String.format("{%s, %s}", leftItem, rightItem);
}
}
}
Expand Up @@ -1421,4 +1421,12 @@ public void testZippingIterator() {
assertTrue(IteratorUtils.zippingIterator(ie, ie, ie) instanceof ZippingIterator, "create instance fail");
assertTrue(IteratorUtils.zippingIterator(ie, ie) instanceof ZippingIterator, "create instance fail");
}

@Test
public void testPairedIterator() {
final ArrayList<String> stringList = new ArrayList<>();
final ArrayList<Integer> integerList = new ArrayList<>();

assertTrue(IteratorUtils.pairedIterator(stringList.iterator(), integerList.iterator()) instanceof PairedIterator, "create instance failed");
}
}