diff --git a/.asf.yaml b/.asf.yaml index e4ab855480..52eef86cbf 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -5,7 +5,7 @@ # (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 +# https://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, @@ -23,7 +23,8 @@ notifications: pullrequests: issues@commons.apache.org jira_options: link label jobs: notifications@commons.apache.org - issues_bot_dependabot: notifications@commons.apache.org - pullrequests_bot_dependabot: notifications@commons.apache.org + # commits_bot_dependabot: dependabot@commons.apache.org + issues_bot_dependabot: dependabot@commons.apache.org + pullrequests_bot_dependabot: dependabot@commons.apache.org issues_bot_codecov-commenter: notifications@commons.apache.org pullrequests_bot_codecov-commenter: notifications@commons.apache.org diff --git a/.github/GH-ROBOTS.txt b/.github/GH-ROBOTS.txt index e3329e55fb..64a88674fe 100644 --- a/.github/GH-ROBOTS.txt +++ b/.github/GH-ROBOTS.txt @@ -5,7 +5,7 @@ # (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 +# https://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, diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9ebcd0ebb1..90ec55f742 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ # (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 +# https://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, @@ -18,10 +18,8 @@ updates: - package-ecosystem: "maven" directory: "/" schedule: - interval: "weekly" - day: "friday" + interval: "quarterly" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" - day: "friday" + interval: "quarterly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d126a970ce..9ff35c83e7 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,7 +7,7 @@ "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 + https://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 @@ -22,7 +22,9 @@ Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Y Before you push a pull request, review this list: - [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project. +- [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). +- [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? - [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. -- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice. +- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. -- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge. +- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2fa96302bf..e072e3dd79 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -5,7 +5,7 @@ # (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 +# https://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, @@ -37,6 +37,7 @@ jobs: security-events: write strategy: + max-parallel: 20 fail-fast: false matrix: language: [ 'java' ] @@ -45,10 +46,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 #v5.0.3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -57,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 + uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 + uses: github/codeql-action/autobuild@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 + uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index f2e2e05b3a..a04da50909 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -6,7 +6,7 @@ # "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 +# https://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 @@ -26,6 +26,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: 'Dependency Review PR' - uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0 + uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 122f12b874..70680be10f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -5,7 +5,7 @@ # (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 +# https://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, @@ -26,25 +26,26 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: + max-parallel: 20 matrix: - java: [ 8, 11, 17, 21, 24 ] + java: [ 8, 11, 17, 21, 25 ] experimental: [false] include: - - java: 25-ea + - java: 26-ea experimental: true steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 #v5.0.3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: distribution: 'temurin' java-version: ${{ matrix.java }} diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 3d8aa61c64..7182c34001 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -5,7 +5,7 @@ # (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 +# https://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, @@ -40,12 +40,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # 2.4.1 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # 2.4.3 with: results_file: results.sarif results_format: sarif @@ -57,13 +57,13 @@ jobs: publish_results: true - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: SARIF file path: results.sarif retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # 3.28.15 + uses: github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 50cf2cd0f0..db02a5a6c4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ site-content # Mac files .DS_Store + +# NetBeans files +nb-configuration.xml +nbactions.xml diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3ed501501d..b4342f33ca 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a52fd2e465..6167c6dd26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ Making Changes + Respect the original code style: + Only use spaces for indentation; you can check for unnecessary whitespace with `git diff` before committing. + Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first. -+ Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice. ++ Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best practice. Unit tests are typically in the `src/test/java` directory. + Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. + Write a pull request description that is detailed enough to understand what the pull request does, how, and why. diff --git a/DEVELOPERS-GUIDE.html b/DEVELOPERS-GUIDE.html index 9158e636ab..2215562b55 100644 --- a/DEVELOPERS-GUIDE.html +++ b/DEVELOPERS-GUIDE.html @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/LICENSE.txt b/LICENSE.txt index d645695673..ff9ad4530f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -193,7 +193,7 @@ 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 + https://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, diff --git a/NOTICE.txt b/NOTICE.txt index 518b76e2c9..8c3e93e4e8 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons Collections -Copyright 2001-2025 The Apache Software Foundation +Copyright 2001-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (https://www.apache.org/). diff --git a/PROPOSAL.html b/PROPOSAL.html index 4b72f86e4e..b537b74738 100644 --- a/PROPOSAL.html +++ b/PROPOSAL.html @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index d615e65a9a..473141ccfe 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -266,7 +266,7 @@ Fixed Bugs * COLLECTIONS-836: Correct test of BidiMap to optionally ignore testing the key set matches the values order. Ordering is not specified for some BidiMaps such as DualHashBidiMaps. Thanks to Anant Dahiya. * COLLECTIONS-737: Return 0 immediately if the given iterable is null in IterableUtils#size. Update tests. Thanks to Prodigysov. -* COLLECTIONS-697: JavaDoc for FixedSizeList should warn that modifying underlying list is still allowed and is not prevented Thanks to Ranjan George. +* COLLECTIONS-697: Javadoc for FixedSizeList should warn that modifying underlying list is still allowed and is not prevented Thanks to Ranjan George. * Fill in some map test cases #104. Thanks to dota17. * COLLECTIONS-738: Remove the redundant assertNull in IterableUtilsTest.find and update Javadocs. Thanks to Pengyu Nie. * COLLECTIONS-724: Simplify two remove-if loops #77. Thanks to Eitan Adler. diff --git a/SECURITY.md b/SECURITY.md index 51943ba7b4..744d4cddbb 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/pom.xml b/pom.xml index 8637029eab..df28581c9a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ (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 + https://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, @@ -19,24 +19,24 @@ org.apache.commons commons-parent - 81 + 97 4.0.0 commons-collections4 - 4.5.1-SNAPSHOT + 4.6.0-SNAPSHOT Apache Commons Collections 2001 The Apache Commons Collections package contains types that extend and augment the Java Collections Framework. https://commons.apache.org/proper/commons-collections/ - - jira - https://issues.apache.org/jira/browse/COLLECTIONS - - scm:git:http://gitbox.apache.org/repos/asf/commons-collections.git + scm:git:https://gitbox.apache.org/repos/asf/commons-collections.git scm:git:https://gitbox.apache.org/repos/asf/commons-collections.git https://gitbox.apache.org/repos/asf?p=commons-collections.git + + GitHub + https://github.com/apache/commons-collections/actions + org.junit.jupiter @@ -48,6 +48,11 @@ junit-jupiter-params test + + org.junit-pioneer + junit-pioneer + test + org.easymock easymock @@ -57,25 +62,31 @@ org.apache.commons commons-lang3 - 3.17.0 + 3.20.0 test commons-io commons-io - 2.19.0 + 2.21.0 test commons-codec commons-codec - 1.18.0 + 1.21.0 true com.google.guava guava-testlib - 33.3.1-jre + 33.5.0-jre + test + + + org.openjdk.jmh + jmh-core + ${commons.jmh.version} test @@ -103,8 +114,8 @@ collections org.apache.commons.collections4 - 4.5.0 - 4.5.1 + 4.5.1 + 4.5.2 (Requires Java 8 or above) COLLECTIONS 12310465 @@ -114,7 +125,7 @@ https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-collections site-content - 4.4 + 4.5.0 true 2025-04-22T19:14:37Z @@ -129,9 +140,7 @@ 0.85 0.78 2.0.0 - 5.5.0 - - 7.8.0 + 5.6.0 clean verify apache-rat:check pmd:check checkstyle:check japicmp:cmp javadoc:javadoc @@ -177,11 +186,11 @@ org.apache.rat apache-rat-plugin - - .asf.yaml - site-content/**/* - src/test/resources/org/apache/commons/collections4/data/test/* - + + .asf.yaml + site-content/**/* + src/test/resources/org/apache/commons/collections4/data/test/* + @@ -250,35 +259,6 @@ - - org.apache.maven.plugins - maven-changes-plugin - ${commons.changes.version} - - - %URL%/%ISSUE% - - - false - Fix Version,Key,Summary,Type,Resolution,Status - - Key DESC,Type,Fix Version DESC - Fixed - Resolved,Closed - - Bug,New Feature,Task,Improvement,Wish,Test - ${commons.release.version} - 500 - - - - - changes-report - jira-report - - - - maven-checkstyle-plugin @@ -298,11 +278,11 @@ org.apache.rat apache-rat-plugin - - .asf.yaml - site-content/**/* - src/test/resources/org/apache/commons/collections4/data/test/* - + + .asf.yaml + site-content/**/* + src/test/resources/org/apache/commons/collections4/data/test/* + @@ -391,6 +371,70 @@ + + + benchmark + + true + org.apache + + + + org.openjdk.jmh + jmh-core + ${commons.jmh.version} + test + + + org.openjdk.jmh + jmh-generator-annprocess + ${commons.jmh.version} + test + + + + + + + maven-compiler-plugin + ${commons.compiler.version} + + + **/* + + + + + + org.codehaus.mojo + exec-maven-plugin + + + benchmark + test + + exec + + + test + java + + -classpath + + org.openjdk.jmh.Main + -rf + json + -rff + target/jmh-result.json + ${benchmark} + + + + + + + + diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml index efea74cc7c..df9765ebae 100644 --- a/src/assembly/bin.xml +++ b/src/assembly/bin.xml @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/src/assembly/src.xml b/src/assembly/src.xml index 64edccd6cf..b865bc13ae 100644 --- a/src/assembly/src.xml +++ b/src/assembly/src.xml @@ -6,7 +6,7 @@ (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 + https://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, diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 2ad85c0f26..70967d8b4f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,7 +7,7 @@ (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 + https://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, @@ -22,6 +22,39 @@ Apache Commons Collections Release Notes + + + org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceEntry.toReference(ReferenceStrength, T, int) now throws IllegalArgumentException instead of Error. + Remove deprecation annotation of org.apache.commons.collections4.Factory; this will be deprecated in 5.0 in favor of java.util.function.Supplier. + Remove deprecation annotation of org.apache.commons.collections4.Predicate; this will be deprecated in 5.0 in favor of java.util.function.Predicate. + Remove deprecation annotation of org.apache.commons.collections4.Transformer; this will be deprecated in 5.0 in favor of java.util.function.Function. + Remove deprecation annotation of org.apache.commons.collections4.Closure; this will be deprecated in 5.0 in favor of java.util.function.Consumer. + MapUtils.getLongValue(Map, K, Function) returns a byte instead of a long. + Fix exception message in org.apache.commons.collections4.functors.FunctorUtils.validate(Consumer...) + Fix exception message in org.apache.commons.collections4.iterators.UnmodifiableIterator.remove() to match java.util.Iterator.remove(). + Calling SetUtils.union on multiple instances of SetView causes JVM to hang + Improve IteratorUtils.chainedIterator() performance. + Fix UselessOverridingMethod in org.apache.commons.collections4.properties.PropertiesFactory. + OrderedProperties.stringPropertyNames() returns an unordered Set. + Fix SortedProperties.keySet() returned an unsorted Set. + Fix SortedProperties.propertyNames() returned an unsorted Enumeration. + Fix SortedProperties.stringPropertyNames() returned an unsorted Set. + Fix SortedProperties.forEach() called its consumer out of order. + Fix Apache RAT plugin console warnings. + Add MultiValuedMap.inverted() #665. + + Add generics to UnmodifiableIterator for the wrapped type. + Add a Maven benchmark profile for JMH. + Add a Maven benchmark profile for JMH. + + Bump org.apache.commons:commons-parent from 81 to 97 #612, #645, #662, #663. + Bump com.google.guava:guava-testlib from 33.3.1-jre to 33.5.0-jre #644. + Bump PMD from 7.8.0 to 7.13.0 (now inherited from parent POM). + Bump org.easymock:easymock from 5.5.0 to 5.6.0 #617. + [test] Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.20.0 #625. + [test] Bump commons-io:commons-io from 2.19.0 to 2.21.0. + Bump commons-codec:commons-codec from 1.18.0 to 1.21.0. + Refactor AbstractPropertiesFactory.load(File) to use NIO. @@ -239,7 +272,7 @@ Return 0 immediately if the given iterable is null in IterableUtils#size. Update tests. - JavaDoc for FixedSizeList should warn that modifying underlying list is still allowed and is not prevented + Javadoc for FixedSizeList should warn that modifying underlying list is still allowed and is not prevented Fill in some map test cases #104. diff --git a/src/changes/release-notes.vm b/src/changes/release-notes.vm index 565d491be8..b3355d74be 100644 --- a/src/changes/release-notes.vm +++ b/src/changes/release-notes.vm @@ -6,7 +6,7 @@ ## "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 +## https://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 diff --git a/src/conf/checkstyle-suppressions.xml b/src/conf/checkstyle-suppressions.xml index 36be7fec52..a95b658bf4 100644 --- a/src/conf/checkstyle-suppressions.xml +++ b/src/conf/checkstyle-suppressions.xml @@ -7,7 +7,7 @@ (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 + https://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, diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml index 74e94b2e27..e85df3ec6b 100644 --- a/src/conf/checkstyle.xml +++ b/src/conf/checkstyle.xml @@ -7,7 +7,7 @@ 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 + https://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, diff --git a/src/conf/findbugs-exclude-filter.xml b/src/conf/findbugs-exclude-filter.xml index b241b323b8..20b59845d0 100644 --- a/src/conf/findbugs-exclude-filter.xml +++ b/src/conf/findbugs-exclude-filter.xml @@ -7,7 +7,7 @@ (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 + https://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, diff --git a/src/conf/license-header.txt b/src/conf/license-header.txt index ae6f28c4a1..e6672d9f35 100644 --- a/src/conf/license-header.txt +++ b/src/conf/license-header.txt @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/ArrayStack.java b/src/main/java/org/apache/commons/collections4/ArrayStack.java index 4f21ea0cd8..0640d13499 100644 --- a/src/main/java/org/apache/commons/collections4/ArrayStack.java +++ b/src/main/java/org/apache/commons/collections4/ArrayStack.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -41,7 +41,7 @@ * @param the type of elements in this list * @see java.util.Stack * @since 1.0 - * @deprecated use {@link java.util.ArrayDeque} instead (available from Java 1.6) + * @deprecated Use {@link java.util.ArrayDeque} instead (available from Java 1.6) */ @Deprecated public class ArrayStack extends ArrayList { diff --git a/src/main/java/org/apache/commons/collections4/ArrayUtils.java b/src/main/java/org/apache/commons/collections4/ArrayUtils.java index 4cea41c9e8..8fdbab1447 100644 --- a/src/main/java/org/apache/commons/collections4/ArrayUtils.java +++ b/src/main/java/org/apache/commons/collections4/ArrayUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -46,7 +46,7 @@ final class ArrayUtils { * * @param array the array to search, may be {@code null}. * @param objectToFind the object to find, may be {@code null}. - * @return {@code true} if the array contains the object + * @return {@code true} if the array contains the object. */ static boolean contains(final Object[] array, final Object objectToFind) { return indexOf(array, objectToFind) != CollectionUtils.INDEX_NOT_FOUND; @@ -65,9 +65,9 @@ static boolean contains(final Object[] array, final Object objectToFind) { * * @param array the array to search for the object, may be {@code null}. * @param objectToFind the object to find, may be {@code null}. - * @param startIndex the index to start searching at + * @param startIndex the index to start searching. * @return the index of the object within the array starting at the index, {@link CollectionUtils#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} - * array input + * array input. */ static int indexOf(final Object[] array, final Object objectToFind, int startIndex) { if (array == null) { @@ -102,7 +102,7 @@ static int indexOf(final Object[] array, final Object objectToFind, int startInd * * @param array the array to search for the object, may be {@code null}. * @param objectToFind the object to find, may be {@code null}. - * @return the index of the object within the array, {@link CollectionUtils#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input + * @return the index of the object within the array, {@link CollectionUtils#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input. */ static int indexOf(final T[] array, final Object objectToFind) { return indexOf(array, objectToFind, 0); diff --git a/src/main/java/org/apache/commons/collections4/Bag.java b/src/main/java/org/apache/commons/collections4/Bag.java index b06061a016..c1e662d7e4 100644 --- a/src/main/java/org/apache/commons/collections4/Bag.java +++ b/src/main/java/org/apache/commons/collections4/Bag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/BagUtils.java b/src/main/java/org/apache/commons/collections4/BagUtils.java index 2cffccf587..258bc9a731 100644 --- a/src/main/java/org/apache/commons/collections4/BagUtils.java +++ b/src/main/java/org/apache/commons/collections4/BagUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/BidiMap.java b/src/main/java/org/apache/commons/collections4/BidiMap.java index 0135c6f9a3..31f2496cf5 100644 --- a/src/main/java/org/apache/commons/collections4/BidiMap.java +++ b/src/main/java/org/apache/commons/collections4/BidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/BoundedCollection.java b/src/main/java/org/apache/commons/collections4/BoundedCollection.java index 6ab5f2916e..2f180676eb 100644 --- a/src/main/java/org/apache/commons/collections4/BoundedCollection.java +++ b/src/main/java/org/apache/commons/collections4/BoundedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/BoundedMap.java b/src/main/java/org/apache/commons/collections4/BoundedMap.java index 3a45372fe6..29ecb3933e 100644 --- a/src/main/java/org/apache/commons/collections4/BoundedMap.java +++ b/src/main/java/org/apache/commons/collections4/BoundedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Closure.java b/src/main/java/org/apache/commons/collections4/Closure.java index ef6cf32462..4ccf1493ea 100644 --- a/src/main/java/org/apache/commons/collections4/Closure.java +++ b/src/main/java/org/apache/commons/collections4/Closure.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -17,6 +17,7 @@ package org.apache.commons.collections4; import java.util.function.Consumer; +import java.util.function.Supplier; /** * Defines a functor interface implemented by classes that do something. @@ -31,9 +32,9 @@ * * @param the type of the input to the operation. * @since 1.0 - * @deprecated Use {@link Consumer}. + * This will be deprecated in 5.0 in favor of {@link Supplier}. */ -@Deprecated +//@Deprecated public interface Closure extends Consumer { @Override diff --git a/src/main/java/org/apache/commons/collections4/ClosureUtils.java b/src/main/java/org/apache/commons/collections4/ClosureUtils.java index f56529730f..4ad525c4dd 100644 --- a/src/main/java/org/apache/commons/collections4/ClosureUtils.java +++ b/src/main/java/org/apache/commons/collections4/ClosureUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -35,25 +35,25 @@ * {@code ClosureUtils} provides reference implementations and utilities * for the Closure functor interface. The supplied closures are: *
    - *
  • Invoker - invokes a method on the input object - *
  • For - repeatedly calls a closure for a fixed number of times - *
  • While - repeatedly calls a closure while a predicate is true - *
  • Chained - chains two or more closures together - *
  • If - calls one closure or another based on a predicate - *
  • Switch - calls one closure based on one or more predicates - *
  • SwitchMap - calls one closure looked up from a Map - *
  • Transformer - wraps a Transformer as a Closure - *
  • NOP - does nothing - *
  • Exception - always throws an exception + *
  • Invoker - invokes a method on the input object
  • + *
  • For - repeatedly calls a closure for a fixed number of times
  • + *
  • While - repeatedly calls a closure while a predicate is true
  • + *
  • Chained - chains two or more closures together
  • + *
  • If - calls one closure or another based on a predicate
  • + *
  • Switch - calls one closure based on one or more predicates
  • + *
  • SwitchMap - calls one closure looked up from a Map
  • + *
  • Transformer - wraps a Transformer as a Closure
  • + *
  • NOP - does nothing
  • + *
  • Exception - always throws an exception
  • *
*

* Since v4.1 only closures which are considered to be safe are * Serializable. Closures considered to be unsafe for serialization are: *

*
    - *
  • Invoker - *
  • For - *
  • While + *
  • Invoker
  • + *
  • For
  • + *
  • While
  • *
* * @since 3.0 diff --git a/src/main/java/org/apache/commons/collections4/CollectionUtils.java b/src/main/java/org/apache/commons/collections4/CollectionUtils.java index 4a73133611..9cc1b80e60 100644 --- a/src/main/java/org/apache/commons/collections4/CollectionUtils.java +++ b/src/main/java/org/apache/commons/collections4/CollectionUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -58,6 +58,7 @@ public class CollectionUtils { /** * Helper class to easily access cardinality properties of two collections. + * * @param the element type */ private static class CardinalityHelper { @@ -169,6 +170,7 @@ public int hashCode() { /** * Helper class for set-related operations, for example union, subtract, intersection. + * * @param the element type */ private static final class SetOperationCardinalityHelper extends CardinalityHelper implements Iterable { @@ -181,6 +183,7 @@ private static final class SetOperationCardinalityHelper extends CardinalityH /** * Create a new set operation helper from the two collections. + * * @param a the first collection * @param b the second collection */ @@ -200,6 +203,7 @@ public Iterator iterator() { /** * Returns the resulting collection. + * * @return the result */ public Collection list() { @@ -208,6 +212,7 @@ public Collection list() { /** * Add the object {@code count} times to the result collection. + * * @param obj the object to add * @param count the count */ @@ -363,7 +368,7 @@ public static boolean addIgnoreNull(final Collection collection, final T * @param the type of object that the {@link Iterable} may contain. * @return the number of occurrences of obj in coll * @throws NullPointerException if collection is null - * @deprecated since 4.1, use {@link IterableUtils#frequency(Iterable, Object)} instead. + * @deprecated Since 4.1, use {@link IterableUtils#frequency(Iterable, Object)} instead. * Be aware that the order of parameters has changed. */ @Deprecated @@ -373,6 +378,7 @@ public static int cardinality(final O obj, final Iterable collect /** * Ensures an index is not negative. + * * @param index the index to check. * @throws IndexOutOfBoundsException if the index is negative. */ @@ -718,7 +724,7 @@ public static boolean containsAny(final Collection coll1, @SuppressWarnin * @param input the {@link Iterable} to get the input from, may be null * @param predicate the predicate to use, may be null * @return the number of matches for the predicate in the collection - * @deprecated since 4.1, use {@link IterableUtils#countMatches(Iterable, Predicate)} instead + * @deprecated Since 4.1, use {@link IterableUtils#countMatches(Iterable, Predicate)} instead */ @Deprecated public static int countMatches(final Iterable input, final Predicate predicate) { @@ -736,9 +742,9 @@ public static int countMatches(final Iterable input, final Predicate *

* This is equivalent to - * {@code {@link #subtract subtract}({@link #union union(a,b)},{@link #intersection intersection(a,b)})} + * {@code {@link #subtract subtract}({@link #union union(a, b)},{@link #intersection intersection(a, b)})} * or - * {@code {@link #union union}({@link #subtract subtract(a,b)},{@link #subtract subtract(b,a)})}. + * {@code {@link #union union}({@link #subtract subtract(a, b)},{@link #subtract subtract(b, a)})}. *

* * @param a the first collection, must not be null @@ -794,7 +800,7 @@ public static Collection emptyIfNull(final Collection collection) { * @param input the {@link Iterable} to get the input from, may be null * @param predicate the predicate to use, may be null * @return true if at least one element of the collection matches the predicate - * @deprecated since 4.1, use {@link IterableUtils#matchesAny(Iterable, Predicate)} instead + * @deprecated Since 4.1, use {@link IterableUtils#matchesAny(Iterable, Predicate)} instead */ @Deprecated public static boolean exists(final Iterable input, final Predicate predicate) { @@ -875,7 +881,7 @@ public static boolean filterInverse(final Iterable collection, final Pred * @param collection the collection to search, may be null * @param predicate the predicate to use, may be null * @return the first element of the collection which matches the predicate or null if none could be found - * @deprecated since 4.1, use {@link IterableUtils#find(Iterable, Predicate)} instead + * @deprecated Since 4.1, use {@link IterableUtils#find(Iterable, Predicate)} instead */ @Deprecated public static T find(final Iterable collection, final Predicate predicate) { @@ -894,7 +900,7 @@ public static T find(final Iterable collection, final Predicate> T forAllButLastDo(final Iterable collection, @@ -914,7 +920,7 @@ public static > T forAllButLastDo(final Iterable * @param closure the closure to perform, may be null * @return the last element in the collection, or null if either iterator or closure is null * @since 4.0 - * @deprecated since 4.1, use {@link IteratorUtils#forEachButLast(Iterator, Closure)} instead + * @deprecated Since 4.1, use {@link IteratorUtils#forEachButLast(Iterator, Closure)} instead */ @Deprecated public static > T forAllButLastDo(final Iterator iterator, final C closure) { @@ -932,7 +938,7 @@ public static > T forAllButLastDo(final Iterator * @param collection the collection to get the input from, may be null * @param closure the closure to perform, may be null * @return closure - * @deprecated since 4.1, use {@link IterableUtils#forEach(Iterable, Closure)} instead + * @deprecated Since 4.1, use {@link IterableUtils#forEach(Iterable, Closure)} instead */ @Deprecated public static > C forAllDo(final Iterable collection, final C closure) { @@ -954,7 +960,7 @@ public static > C forAllDo(final Iterable col * @param closure the closure to perform, may be null * @return closure * @since 4.0 - * @deprecated since 4.1, use {@link IteratorUtils#forEach(Iterator, Closure)} instead + * @deprecated Since 4.1, use {@link IteratorUtils#forEach(Iterator, Closure)} instead */ @Deprecated public static > C forAllDo(final Iterator iterator, final C closure) { @@ -976,7 +982,7 @@ public static > C forAllDo(final Iterator ite * @param the type of object in the {@link Iterable}. * @return the object at the specified index * @throws IndexOutOfBoundsException if the index is invalid - * @deprecated since 4.1, use {@code IterableUtils.get(Iterable, int)} instead + * @deprecated Since 4.1, use {@code IterableUtils.get(Iterable, int)} instead */ @Deprecated public static T get(final Iterable iterable, final int index) { @@ -999,7 +1005,7 @@ public static T get(final Iterable iterable, final int index) { * @throws IndexOutOfBoundsException if the index is invalid * @throws IllegalArgumentException if the object type is invalid * @throws NullPointerException if iterator is null - * @deprecated since 4.1, use {@code IteratorUtils.get(Iterator, int)} instead + * @deprecated Since 4.1, use {@code IteratorUtils.get(Iterator, int)} instead */ @Deprecated public static T get(final Iterator iterator, final int index) { @@ -1361,7 +1367,7 @@ public static boolean isSubCollection(final Collection a, final Collection * @return true if every element of the collection matches the predicate or if the * collection is empty, false otherwise * @since 4.0 - * @deprecated since 4.1, use {@link IterableUtils#matchesAll(Iterable, Predicate)} instead + * @deprecated Since 4.1, use {@link IterableUtils#matchesAll(Iterable, Predicate)} instead */ @Deprecated public static boolean matchesAll(final Iterable input, final Predicate predicate) { @@ -1838,11 +1844,11 @@ public static > R selectRejected(final Iterab * This method can handles objects as follows *

*
    - *
  • Collection - the collection size - *
  • Map - the map size - *
  • Array - the array size - *
  • Iterator - the number of elements remaining in the iterator - *
  • Enumeration - the number of elements remaining in the enumeration + *
  • Collection - the collection size
  • + *
  • Map - the map size
  • + *
  • Array - the array size
  • + *
  • Iterator - the number of elements remaining in the iterator
  • + *
  • Enumeration - the number of elements remaining in the enumeration
  • *
* * @param object the object to get the size of, may be null @@ -1887,11 +1893,11 @@ public static int size(final Object object) { * This method can handles objects as follows *

*
    - *
  • Collection - via collection isEmpty - *
  • Map - via map isEmpty - *
  • Array - using array size - *
  • Iterator - via hasNext - *
  • Enumeration - via hasMoreElements + *
  • Collection - via collection isEmpty
  • + *
  • Map - via map isEmpty
  • + *
  • Array - using array size
  • + *
  • Iterator - via hasNext
  • + *
  • Enumeration - via hasMoreElements
  • *
*

* Note: This method is named to avoid clashing with @@ -2020,7 +2026,7 @@ public static Collection subtract(final Iterable a, * @param collection the collection to synchronize, must not be null * @return a synchronized collection backed by the given collection * @throws NullPointerException if the collection is null - * @deprecated since 4.1, use {@link java.util.Collections#synchronizedCollection(Collection)} instead + * @deprecated Since 4.1, use {@link java.util.Collections#synchronizedCollection(Collection)} instead */ @Deprecated public static Collection synchronizedCollection(final Collection collection) { @@ -2127,7 +2133,7 @@ public static Collection union(final Iterable a, final Itera * @param collection the collection to make unmodifiable, must not be null * @return an unmodifiable collection backed by the given collection * @throws NullPointerException if the collection is null - * @deprecated since 4.1, use {@link java.util.Collections#unmodifiableCollection(Collection)} instead + * @deprecated Since 4.1, use {@link java.util.Collections#unmodifiableCollection(Collection)} instead */ @Deprecated public static Collection unmodifiableCollection(final Collection collection) { diff --git a/src/main/java/org/apache/commons/collections4/ComparatorUtils.java b/src/main/java/org/apache/commons/collections4/ComparatorUtils.java index 90dbb259e5..5a0e62b240 100644 --- a/src/main/java/org/apache/commons/collections4/ComparatorUtils.java +++ b/src/main/java/org/apache/commons/collections4/ComparatorUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/EnumerationUtils.java b/src/main/java/org/apache/commons/collections4/EnumerationUtils.java index 29252eb9b2..99853abe3a 100644 --- a/src/main/java/org/apache/commons/collections4/EnumerationUtils.java +++ b/src/main/java/org/apache/commons/collections4/EnumerationUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Equator.java b/src/main/java/org/apache/commons/collections4/Equator.java index db5cdf8684..9d99322ffc 100644 --- a/src/main/java/org/apache/commons/collections4/Equator.java +++ b/src/main/java/org/apache/commons/collections4/Equator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -27,6 +27,7 @@ * @since 4.0 */ public interface Equator { + /** * Evaluates the two arguments for their equality. * diff --git a/src/main/java/org/apache/commons/collections4/Factory.java b/src/main/java/org/apache/commons/collections4/Factory.java index 56fd5d5f62..c5182a686b 100644 --- a/src/main/java/org/apache/commons/collections4/Factory.java +++ b/src/main/java/org/apache/commons/collections4/Factory.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -32,9 +32,9 @@ * * @param the type of results supplied by this supplier. * @since 2.1 - * @deprecated Use {@link Supplier}. + * This will be deprecated in 5.0 in favor of {@link Supplier}. */ -@Deprecated +//@Deprecated public interface Factory extends Supplier { /** diff --git a/src/main/java/org/apache/commons/collections4/FactoryUtils.java b/src/main/java/org/apache/commons/collections4/FactoryUtils.java index 61b5207402..b80c7faf56 100644 --- a/src/main/java/org/apache/commons/collections4/FactoryUtils.java +++ b/src/main/java/org/apache/commons/collections4/FactoryUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -25,19 +25,19 @@ * {@code FactoryUtils} provides reference implementations and utilities * for the Factory functor interface. The supplied factories are: *

    - *
  • Prototype - clones a specified object - *
  • Instantiate - creates objects using reflection - *
  • Constant - always returns the same object - *
  • Null - always returns null - *
  • Exception - always throws an exception + *
  • Prototype - clones a specified object
  • + *
  • Instantiate - creates objects using reflection
  • + *
  • Constant - always returns the same object
  • + *
  • Null - always returns null
  • + *
  • Exception - always throws an exception
  • *
*

* Since v4.1 only factories which are considered to be safe are * Serializable. Factories considered to be unsafe for serialization are: *

*
    - *
  • Prototype - *
  • Instantiate + *
  • Prototype
  • + *
  • Instantiate
  • *
* * @since 3.0 diff --git a/src/main/java/org/apache/commons/collections4/FluentIterable.java b/src/main/java/org/apache/commons/collections4/FluentIterable.java index 65e391403c..77523d3596 100644 --- a/src/main/java/org/apache/commons/collections4/FluentIterable.java +++ b/src/main/java/org/apache/commons/collections4/FluentIterable.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -35,12 +35,11 @@ *

*
    *
  • fluent methods which return a new {@code FluentIterable} instance, - * providing a view of the original iterable (for example filter(Predicate)); + * providing a view of the original iterable (for example filter(Predicate));
  • *
  • conversion methods which copy the FluentIterable's contents into a - * new collection or array (for example toList()); + * new collection or array (for example toList());
  • *
  • utility methods which answer questions about the FluentIterable's - * contents (for example size(), anyMatch(Predicate)). - *
  • + * contents (for example size(), anyMatch(Predicate)).
  • *
*

* The following example outputs the first 3 even numbers in the range [1, 10] @@ -139,6 +138,7 @@ public static FluentIterable of(final T... elements) { /** * Create a new FluentIterable by wrapping the provided iterable. + * * @param iterable the iterable to wrap */ private FluentIterable(final Iterable iterable) { @@ -218,8 +218,8 @@ public Enumeration asEnumeration() { * Example: natural ordering *

*
    - *
  • this contains elements [1, 3, 5, 7] - *
  • other contains elements [2, 4, 6, 8] + *
  • this contains elements [1, 3, 5, 7]
  • + *
  • other contains elements [2, 4, 6, 8]
  • *
*

* The returned iterable will traverse the elements in the following @@ -243,8 +243,8 @@ public FluentIterable collate(final Iterable other) { * Example: descending order *

*
    - *
  • this contains elements [7, 5, 3, 1] - *
  • other contains elements [8, 6, 4, 2] + *
  • this contains elements [7, 5, 3, 1]
  • + *
  • other contains elements [8, 6, 4, 2]
  • *
*

* The returned iterable will traverse the elements in the following diff --git a/src/main/java/org/apache/commons/collections4/FunctorException.java b/src/main/java/org/apache/commons/collections4/FunctorException.java index 64fc0d4c52..10794deadf 100644 --- a/src/main/java/org/apache/commons/collections4/FunctorException.java +++ b/src/main/java/org/apache/commons/collections4/FunctorException.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Get.java b/src/main/java/org/apache/commons/collections4/Get.java index e388400b23..275269f92f 100644 --- a/src/main/java/org/apache/commons/collections4/Get.java +++ b/src/main/java/org/apache/commons/collections4/Get.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/IterableGet.java b/src/main/java/org/apache/commons/collections4/IterableGet.java index f78c85fe78..0c3b893729 100644 --- a/src/main/java/org/apache/commons/collections4/IterableGet.java +++ b/src/main/java/org/apache/commons/collections4/IterableGet.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -25,6 +25,7 @@ * @see Put */ public interface IterableGet extends Get { + /** * Obtains a {@code MapIterator} over the map. *

diff --git a/src/main/java/org/apache/commons/collections4/IterableMap.java b/src/main/java/org/apache/commons/collections4/IterableMap.java index 1cf3d5fb70..93474a830d 100644 --- a/src/main/java/org/apache/commons/collections4/IterableMap.java +++ b/src/main/java/org/apache/commons/collections4/IterableMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/IterableSortedMap.java b/src/main/java/org/apache/commons/collections4/IterableSortedMap.java index 350b943aa3..83ed3bf0d2 100644 --- a/src/main/java/org/apache/commons/collections4/IterableSortedMap.java +++ b/src/main/java/org/apache/commons/collections4/IterableSortedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/IterableUtils.java b/src/main/java/org/apache/commons/collections4/IterableUtils.java index b320c91fd5..5a06d3fb08 100644 --- a/src/main/java/org/apache/commons/collections4/IterableUtils.java +++ b/src/main/java/org/apache/commons/collections4/IterableUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -39,10 +39,10 @@ *

*
    *
  • All decorator methods are not null-safe for the provided Iterable argument; for example, they will throw a {@link NullPointerException} if a - * null Iterable is passed as argument. + * null Iterable is passed as argument.
  • *
  • All other utility methods are null-safe for the provided Iterable argument; for example, they will treat a null Iterable the same way as an empty one. * For other arguments which are null, a {@link Predicate} will result in a {@link NullPointerException}. Exception: passing a null {@link Comparator} is - * equivalent to a Comparator with natural ordering. + * equivalent to a Comparator with natural ordering.
  • *
* * @since 4.1 @@ -624,7 +624,7 @@ public Iterator iterator() { return new LazyIteratorChain() { @Override protected Iterator nextIterator(final int count) { - if (IterableUtils.isEmpty(iterable)) { + if (IterableUtils.isEmpty(iterable)) { //NOPMD: qualifier is needed here return null; } return iterable.iterator(); diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java index 02e8be85fd..6a7e53d0de 100644 --- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java +++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -112,6 +112,7 @@ public class IteratorUtils { */ @SuppressWarnings("rawtypes") public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE; + /** * Default delimiter used to delimit elements while converting an Iterator * to its String representation. @@ -392,7 +393,6 @@ public static Iterable asMultipleUseIterable(final Iterator return new IteratorIterable<>(iterator, true); } - // Bounded /** * Decorates the specified iterator to return at most the given number * of elements. @@ -759,6 +759,7 @@ private static E find(final Iterator iterator, final Predicate * The Iterator is advanced to {@code 0} (or to the end, if * {@code 0} exceeds the number of entries) as a side effect of this method. *

+ * * @param the type of object in the {@link Iterator} * @param iterator the iterator to get a value from * @return the first object @@ -866,17 +867,17 @@ static E get(final Iterator iterator, final int index, final IntFunction< * This method can handle objects as follows *

*
    - *
  • null - empty iterator - *
  • Iterator - returned directly - *
  • Enumeration - wrapped - *
  • Collection - iterator from collection returned - *
  • Map - values iterator returned - *
  • Dictionary - values (elements) enumeration returned as iterator - *
  • array - iterator over array returned - *
  • object with iterator() public method accessed by reflection - *
  • object - singleton iterator - *
  • NodeList - iterator over the list - *
  • Node - iterator over the child nodes + *
  • null - empty iterator
  • + *
  • Iterator - returned directly
  • + *
  • Enumeration - wrapped
  • + *
  • Collection - iterator from collection returned
  • + *
  • Map - values iterator returned
  • + *
  • Dictionary - values (elements) enumeration returned as iterator
  • + *
  • array - iterator over array returned
  • + *
  • object with iterator() public method accessed by reflection
  • + *
  • object - singleton iterator
  • + *
  • NodeList - iterator over the list
  • + *
  • Node - iterator over the child nodes
  • *
* * @param obj the object to convert to an iterator diff --git a/src/main/java/org/apache/commons/collections4/KeyValue.java b/src/main/java/org/apache/commons/collections4/KeyValue.java index 0576ea3af2..c1d5b326d2 100644 --- a/src/main/java/org/apache/commons/collections4/KeyValue.java +++ b/src/main/java/org/apache/commons/collections4/KeyValue.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/ListUtils.java b/src/main/java/org/apache/commons/collections4/ListUtils.java index 18149924c5..7d658cb434 100644 --- a/src/main/java/org/apache/commons/collections4/ListUtils.java +++ b/src/main/java/org/apache/commons/collections4/ListUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -96,6 +96,7 @@ public void visitKeepCommand(final E object) { /** * Provides a partition view on a {@link List}. + * * @since 4.0 */ private static final class Partition extends AbstractList> { diff --git a/src/main/java/org/apache/commons/collections4/ListValuedMap.java b/src/main/java/org/apache/commons/collections4/ListValuedMap.java index f87b4253c7..5a9ef35809 100644 --- a/src/main/java/org/apache/commons/collections4/ListValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/ListValuedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/MapIterator.java b/src/main/java/org/apache/commons/collections4/MapIterator.java index c9c76fc9c6..fafa7b6ee5 100644 --- a/src/main/java/org/apache/commons/collections4/MapIterator.java +++ b/src/main/java/org/apache/commons/collections4/MapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/MapUtils.java b/src/main/java/org/apache/commons/collections4/MapUtils.java index 3f99a47ed7..800199dfe2 100644 --- a/src/main/java/org/apache/commons/collections4/MapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MapUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -60,19 +60,19 @@ *

* *
    - *
  • {@link #fixedSizeMap(Map)} - *
  • {@link #fixedSizeSortedMap(SortedMap)} - *
  • {@link #lazyMap(Map,Factory)} - *
  • {@link #lazyMap(Map,Transformer)} - *
  • {@link #lazySortedMap(SortedMap,Factory)} - *
  • {@link #lazySortedMap(SortedMap,Transformer)} - *
  • {@link #predicatedMap(Map,Predicate,Predicate)} - *
  • {@link #predicatedSortedMap(SortedMap,Predicate,Predicate)} - *
  • {@link #transformedMap(Map, Transformer, Transformer)} - *
  • {@link #transformedSortedMap(SortedMap, Transformer, Transformer)} - *
  • {@link #multiValueMap(Map)} - *
  • {@link #multiValueMap(Map, Class)} - *
  • {@link #multiValueMap(Map, Factory)} + *
  • {@link #fixedSizeMap(Map)}
  • + *
  • {@link #fixedSizeSortedMap(SortedMap)}
  • + *
  • {@link #lazyMap(Map,Factory)}
  • + *
  • {@link #lazyMap(Map,Transformer)}
  • + *
  • {@link #lazySortedMap(SortedMap,Factory)}
  • + *
  • {@link #lazySortedMap(SortedMap,Transformer)}
  • + *
  • {@link #predicatedMap(Map,Predicate,Predicate)}
  • + *
  • {@link #predicatedSortedMap(SortedMap,Predicate,Predicate)}
  • + *
  • {@link #transformedMap(Map, Transformer, Transformer)}
  • + *
  • {@link #transformedSortedMap(SortedMap, Transformer, Transformer)}
  • + *
  • {@link #multiValueMap(Map)}
  • + *
  • {@link #multiValueMap(Map, Class)}
  • + *
  • {@link #multiValueMap(Map, Factory)}
  • *
* * @since 1.0 @@ -838,7 +838,7 @@ public static long getLongValue(final Map map, final K key) { */ public static long getLongValue(final Map map, final K key, final Function defaultFunction) { - return applyDefaultFunction(map, key, MapUtils::getLong, defaultFunction, 0L).byteValue(); + return applyDefaultFunction(map, key, MapUtils::getLong, defaultFunction, 0L).longValue(); } /** @@ -1417,7 +1417,7 @@ public static SortedMap lazySortedMap(final SortedMap map, * @return a multi-value map backed by the given map which returns ArrayLists of values. * @see MultiValueMap * @since 3.2 - * @deprecated since 4.1, use {@link MultiValuedMap} instead + * @deprecated Since 4.1, use {@link MultiValuedMap} instead */ @Deprecated public static MultiValueMap multiValueMap(final Map> map) { @@ -1436,7 +1436,7 @@ public static MultiValueMap multiValueMap(final Map> MultiValueMap multiValueMap(final Map map, @@ -1457,7 +1457,7 @@ public static > MultiValueMap multiValueMap( * factory * @see MultiValueMap * @since 3.2 - * @deprecated since 4.1, use {@link MultiValuedMap} instead + * @deprecated Since 4.1, use {@link MultiValuedMap} instead */ @Deprecated public static > MultiValueMap multiValueMap(final Map map, diff --git a/src/main/java/org/apache/commons/collections4/MultiMap.java b/src/main/java/org/apache/commons/collections4/MultiMap.java index bb46f89d60..afb5f54e79 100644 --- a/src/main/java/org/apache/commons/collections4/MultiMap.java +++ b/src/main/java/org/apache/commons/collections4/MultiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -46,7 +46,7 @@ * @param the type of the keys in this map * @param the type of the values in this map * @since 2.0 - * @deprecated since 4.1, use {@link MultiValuedMap} instead + * @deprecated Since 4.1, use {@link MultiValuedMap} instead */ @Deprecated public interface MultiMap extends IterableMap { diff --git a/src/main/java/org/apache/commons/collections4/MultiMapUtils.java b/src/main/java/org/apache/commons/collections4/MultiMapUtils.java index 77dee5afe5..226f1dc522 100644 --- a/src/main/java/org/apache/commons/collections4/MultiMapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MultiMapUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.apache.commons.collections4.bag.HashBag; @@ -157,6 +158,29 @@ public static Set getValuesAsSet(final MultiValuedMap map, final return null; } + /** + * Inverts the mappings from an input MultiValuedMap by adding entries to an output MultiValuedMap. The input is unchanged. + *

+ * Use this method to have complete control of the output MultiValuedMap or when merging several inverse mappings. In simple cases, consider using + * {@link MultiValuedMap#inverted()} method. + *

+ * + * @param the input value type and output key type. + * @param the input key type and output value type. + * @param the output MultiValuedMap type where {@code K} is the key type and {@code V} is the value type. + * @param input The input key-value mappings of type {@code }. + * @param output The output value-key mappings of type {@code }. + * @return The updated output MultiValuedMap of type {@code } + * @see MultiValuedMap#inverted() + * @since 4.6.0 + */ + public static > M invert(final MultiValuedMap input, final M output) { + for (final Map.Entry e : input.entries()) { + output.put(e.getValue(), e.getKey()); + } + return output; + } + /** * Null-safe check if the specified {@code MultiValuedMap} is empty. *

diff --git a/src/main/java/org/apache/commons/collections4/MultiSet.java b/src/main/java/org/apache/commons/collections4/MultiSet.java index 2c1c7d80d4..3cb6bbfdf4 100644 --- a/src/main/java/org/apache/commons/collections4/MultiSet.java +++ b/src/main/java/org/apache/commons/collections4/MultiSet.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/MultiSetUtils.java b/src/main/java/org/apache/commons/collections4/MultiSetUtils.java index 419574bca5..a36340c52b 100644 --- a/src/main/java/org/apache/commons/collections4/MultiSetUtils.java +++ b/src/main/java/org/apache/commons/collections4/MultiSetUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/MultiValuedMap.java b/src/main/java/org/apache/commons/collections4/MultiValuedMap.java index 2378c8eb7d..31ae1f005d 100644 --- a/src/main/java/org/apache/commons/collections4/MultiValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/MultiValuedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -140,6 +140,18 @@ public interface MultiValuedMap { */ Collection get(K key); + /** + * Returns a new MultiValuedMap with inverted mappings. + * The new multimap will have a value-to-key mapping + * for each key-to-value mapping in the original. + * + * @return a new MultiValuedMap with inverted mappings + * @since 4.6.0 + */ + default MultiValuedMap inverted() { + throw new UnsupportedOperationException(getClass() + ".inverted()"); + } + /** * Returns {@code true} if this map contains no key-value mappings. * diff --git a/src/main/java/org/apache/commons/collections4/OrderedBidiMap.java b/src/main/java/org/apache/commons/collections4/OrderedBidiMap.java index 207f266c53..c4cd47ff5d 100644 --- a/src/main/java/org/apache/commons/collections4/OrderedBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/OrderedBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/OrderedIterator.java b/src/main/java/org/apache/commons/collections4/OrderedIterator.java index 5a13bd4495..d070241d2d 100644 --- a/src/main/java/org/apache/commons/collections4/OrderedIterator.java +++ b/src/main/java/org/apache/commons/collections4/OrderedIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/OrderedMap.java b/src/main/java/org/apache/commons/collections4/OrderedMap.java index 23c4a29db2..ebbc03f9fd 100644 --- a/src/main/java/org/apache/commons/collections4/OrderedMap.java +++ b/src/main/java/org/apache/commons/collections4/OrderedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/OrderedMapIterator.java b/src/main/java/org/apache/commons/collections4/OrderedMapIterator.java index 344bb46269..623ef8e004 100644 --- a/src/main/java/org/apache/commons/collections4/OrderedMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/OrderedMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Predicate.java b/src/main/java/org/apache/commons/collections4/Predicate.java index e6d7008137..4f2495ef66 100644 --- a/src/main/java/org/apache/commons/collections4/Predicate.java +++ b/src/main/java/org/apache/commons/collections4/Predicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -32,9 +32,9 @@ * * @param the type of the input to the predicate. * @since 1.0 - * @deprecated Use {@link java.util.function.Predicate}. + * This will be deprecated in 5.0 in favor of {@link java.util.function.Predicate}. */ -@Deprecated +//@Deprecated public interface Predicate extends java.util.function.Predicate { /** diff --git a/src/main/java/org/apache/commons/collections4/PredicateUtils.java b/src/main/java/org/apache/commons/collections4/PredicateUtils.java index bced37f9ae..0229f05037 100644 --- a/src/main/java/org/apache/commons/collections4/PredicateUtils.java +++ b/src/main/java/org/apache/commons/collections4/PredicateUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -45,24 +45,24 @@ * {@code PredicateUtils} provides reference implementations and utilities * for the Predicate functor interface. The supplied predicates are: *

    - *
  • Invoker - returns the result of a method call on the input object - *
  • InstanceOf - true if the object is an instanceof a class - *
  • Equal - true if the object equals() a specified object - *
  • Identity - true if the object == a specified object - *
  • Null - true if the object is null - *
  • NotNull - true if the object is not null - *
  • Unique - true if the object has not already been evaluated - *
  • And/All - true if all of the predicates are true - *
  • Or/Any - true if any of the predicates is true - *
  • Either/One - true if only one of the predicate is true - *
  • Neither/None - true if none of the predicates are true - *
  • Not - true if the predicate is false, and vice versa - *
  • Transformer - wraps a Transformer as a Predicate - *
  • True - always return true - *
  • False - always return false - *
  • Exception - always throws an exception - *
  • NullIsException/NullIsFalse/NullIsTrue - check for null input - *
  • Transformed - transforms the input before calling the predicate + *
  • Invoker - returns the result of a method call on the input object
  • + *
  • InstanceOf - true if the object is an instanceof a class
  • + *
  • Equal - true if the object equals() a specified object
  • + *
  • Identity - true if the object == a specified object
  • + *
  • Null - true if the object is null
  • + *
  • NotNull - true if the object is not null
  • + *
  • Unique - true if the object has not already been evaluated
  • + *
  • And/All - true if all of the predicates are true
  • + *
  • Or/Any - true if any of the predicates is true
  • + *
  • Either/One - true if only one of the predicate is true
  • + *
  • Neither/None - true if none of the predicates are true
  • + *
  • Not - true if the predicate is false, and vice versa
  • + *
  • Transformer - wraps a Transformer as a Predicate
  • + *
  • True - always return true
  • + *
  • False - always return false
  • + *
  • Exception - always throws an exception
  • + *
  • NullIsException/NullIsFalse/NullIsTrue - check for null input
  • + *
  • Transformed - transforms the input before calling the predicate
  • *
*

* All the supplied predicates are Serializable. @@ -73,7 +73,7 @@ public class PredicateUtils { /** - * Create a new Predicate that returns true only if all of the specified + * Creates a new Predicate that returns true only if all of the specified * predicates are true. The predicates are checked in iterator order. * If the collection of predicates is empty, then this predicate returns true. * @@ -89,7 +89,7 @@ public static Predicate allPredicate(final Collection Predicate allPredicate(final Predicate... predic } /** - * Create a new Predicate that returns true only if both of the specified + * Creates a new Predicate that returns true only if both of the specified * predicates are true. * * @param the type that the predicate queries @@ -121,7 +121,7 @@ public static Predicate andPredicate(final Predicate predicate } /** - * Create a new Predicate that returns true if any of the specified + * Creates a new Predicate that returns true if any of the specified * predicates are true. The predicates are checked in iterator order. * If the collection of predicates is empty, then this predicate returns false. * @@ -137,7 +137,7 @@ public static Predicate anyPredicate(final Collection Predicate anyPredicate(final Predicate... predic } /** - * Create a new Predicate that wraps a Transformer. The Transformer must + * Creates a new Predicate that wraps a Transformer. The Transformer must * return either {@link Boolean#TRUE} or {@link Boolean#FALSE} otherwise a * PredicateException will be thrown. * @@ -168,7 +168,7 @@ public static Predicate asPredicate(final Transformer } /** - * Create a new Predicate that returns true if one, but not both, of the + * Creates a new Predicate that returns true if one, but not both, of the * specified predicates are true. XOR * * @param the type that the predicate queries @@ -298,7 +298,7 @@ public static Predicate invokerPredicate(final String methodName, final C } /** - * Create a new Predicate that returns true if neither of the specified + * Creates a new Predicate that returns true if neither of the specified * predicates are true. * * @param the type that the predicate queries @@ -316,7 +316,7 @@ public static Predicate neitherPredicate(final Predicate predi } /** - * Create a new Predicate that returns true if none of the specified + * Creates a new Predicate that returns true if none of the specified * predicates are true. The predicates are checked in iterator order. * If the collection of predicates is empty, then this predicate returns true. * @@ -332,7 +332,7 @@ public static Predicate nonePredicate(final Collection Predicate notNullPredicate() { } /** - * Create a new Predicate that returns true if the specified predicate + * Creates a new Predicate that returns true if the specified predicate * returns false and vice versa. * * @param the type that the predicate queries @@ -429,7 +429,7 @@ public static Predicate nullPredicate() { } /** - * Create a new Predicate that returns true if only one of the specified + * Creates a new Predicate that returns true if only one of the specified * predicates are true. The predicates are checked in iterator order. * If the collection of predicates is empty, then this predicate returns false. * @@ -445,7 +445,7 @@ public static Predicate onePredicate(final Collection Predicate onePredicate(final Predicate... predic } /** - * Create a new Predicate that returns true if either of the specified + * Creates a new Predicate that returns true if either of the specified * predicates are true. * * @param the type that the predicate queries diff --git a/src/main/java/org/apache/commons/collections4/Put.java b/src/main/java/org/apache/commons/collections4/Put.java index 529bba9bf5..83e42a77e5 100644 --- a/src/main/java/org/apache/commons/collections4/Put.java +++ b/src/main/java/org/apache/commons/collections4/Put.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/QueueUtils.java b/src/main/java/org/apache/commons/collections4/QueueUtils.java index d5f82b55d2..dcf84cc505 100644 --- a/src/main/java/org/apache/commons/collections4/QueueUtils.java +++ b/src/main/java/org/apache/commons/collections4/QueueUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/ResettableIterator.java b/src/main/java/org/apache/commons/collections4/ResettableIterator.java index 91c2b2e784..c44d6522a8 100644 --- a/src/main/java/org/apache/commons/collections4/ResettableIterator.java +++ b/src/main/java/org/apache/commons/collections4/ResettableIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/ResettableListIterator.java b/src/main/java/org/apache/commons/collections4/ResettableListIterator.java index b3f64075d0..c8a69da7ef 100644 --- a/src/main/java/org/apache/commons/collections4/ResettableListIterator.java +++ b/src/main/java/org/apache/commons/collections4/ResettableListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/SetUtils.java b/src/main/java/org/apache/commons/collections4/SetUtils.java index 447edfaba3..9b77528dfa 100644 --- a/src/main/java/org/apache/commons/collections4/SetUtils.java +++ b/src/main/java/org/apache/commons/collections4/SetUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -81,6 +81,7 @@ public > void copyInto(final S set) { /** * Return an iterator for this view; the returned iterator is * not required to be unmodifiable. + * * @return a new iterator for this view */ protected abstract Iterator createIterator(); @@ -479,7 +480,6 @@ public static Set synchronizedSet(final Set set) { return Collections.synchronizedSet(set); } - // SortedSet /** * Returns a synchronized sorted set backed by the given sorted set. *

@@ -644,6 +644,7 @@ public static SortedSet unmodifiableNavigableSet(final NavigableSet se /** * Creates an unmodifiable set from the given items. If the passed var-args argument is {@code * null}, then the method returns {@code null}. + * * @param the element type * @param items the elements that make up the new set * @return a set diff --git a/src/main/java/org/apache/commons/collections4/SetValuedMap.java b/src/main/java/org/apache/commons/collections4/SetValuedMap.java index 96316d6654..ce2442dad4 100644 --- a/src/main/java/org/apache/commons/collections4/SetValuedMap.java +++ b/src/main/java/org/apache/commons/collections4/SetValuedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/SortedBag.java b/src/main/java/org/apache/commons/collections4/SortedBag.java index b1ce6e0c43..6c49bfd5d5 100644 --- a/src/main/java/org/apache/commons/collections4/SortedBag.java +++ b/src/main/java/org/apache/commons/collections4/SortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/SortedBidiMap.java b/src/main/java/org/apache/commons/collections4/SortedBidiMap.java index 79e60a8719..72cd7e779c 100644 --- a/src/main/java/org/apache/commons/collections4/SortedBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/SortedBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -56,6 +56,7 @@ public interface SortedBidiMap extends OrderedBidiMap, SortedMap valueComparator(); diff --git a/src/main/java/org/apache/commons/collections4/SplitMapUtils.java b/src/main/java/org/apache/commons/collections4/SplitMapUtils.java index 318d490ad6..3b773462da 100644 --- a/src/main/java/org/apache/commons/collections4/SplitMapUtils.java +++ b/src/main/java/org/apache/commons/collections4/SplitMapUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Transformer.java b/src/main/java/org/apache/commons/collections4/Transformer.java index 864152b104..7cdf4ef822 100644 --- a/src/main/java/org/apache/commons/collections4/Transformer.java +++ b/src/main/java/org/apache/commons/collections4/Transformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -36,9 +36,9 @@ * @param the type of the input to the function. * @param the type of the result of the function. * @since 1.0 - * @deprecated Use {@link Function}. + * This will be deprecated in 5.0 in favor of {@link Function}. */ -@Deprecated +//@Deprecated @FunctionalInterface public interface Transformer extends Function { diff --git a/src/main/java/org/apache/commons/collections4/TransformerUtils.java b/src/main/java/org/apache/commons/collections4/TransformerUtils.java index 7d4dfdf63c..3b1bdceabe 100644 --- a/src/main/java/org/apache/commons/collections4/TransformerUtils.java +++ b/src/main/java/org/apache/commons/collections4/TransformerUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -40,31 +40,31 @@ * {@code TransformerUtils} provides reference implementations and * utilities for the Transformer functor interface. The supplied transformers are: *

    - *
  • Invoker - returns the result of a method call on the input object - *
  • Clone - returns a clone of the input object - *
  • Constant - always returns the same object - *
  • Closure - performs a Closure and returns the input object - *
  • Predicate - returns the result of the predicate as a Boolean - *
  • Factory - returns a new object from a factory - *
  • Chained - chains two or more transformers together - *
  • If - calls one transformer or another based on a predicate - *
  • Switch - calls one transformer based on one or more predicates - *
  • SwitchMap - calls one transformer looked up from a Map - *
  • Instantiate - the Class input object is instantiated - *
  • Map - returns an object from a supplied Map - *
  • Null - always returns null - *
  • NOP - returns the input object, which should be immutable - *
  • Exception - always throws an exception - *
  • StringValue - returns a {@link String} representation of the input object + *
  • Invoker - returns the result of a method call on the input object
  • + *
  • Clone - returns a clone of the input object
  • + *
  • Constant - always returns the same object
  • + *
  • Closure - performs a Closure and returns the input object
  • + *
  • Predicate - returns the result of the predicate as a Boolean
  • + *
  • Factory - returns a new object from a factory
  • + *
  • Chained - chains two or more transformers together
  • + *
  • If - calls one transformer or another based on a predicate
  • + *
  • Switch - calls one transformer based on one or more predicates
  • + *
  • SwitchMap - calls one transformer looked up from a Map
  • + *
  • Instantiate - the Class input object is instantiated
  • + *
  • Map - returns an object from a supplied Map
  • + *
  • Null - always returns null
  • + *
  • NOP - returns the input object, which should be immutable
  • + *
  • Exception - always throws an exception
  • + *
  • StringValue - returns a {@link String} representation of the input object
  • *
*

* Since v4.1 only transformers which are considered to be safe are * Serializable. Transformers considered to be unsafe for serialization are: *

*
    - *
  • Invoker - *
  • Clone - *
  • Instantiate + *
  • Invoker
  • + *
  • Clone
  • + *
  • Instantiate
  • *
* * @since 3.0 diff --git a/src/main/java/org/apache/commons/collections4/Trie.java b/src/main/java/org/apache/commons/collections4/Trie.java index 8791b3b44d..98cd6fb1cf 100644 --- a/src/main/java/org/apache/commons/collections4/Trie.java +++ b/src/main/java/org/apache/commons/collections4/Trie.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/TrieUtils.java b/src/main/java/org/apache/commons/collections4/TrieUtils.java index dac6e43619..29a3456084 100644 --- a/src/main/java/org/apache/commons/collections4/TrieUtils.java +++ b/src/main/java/org/apache/commons/collections4/TrieUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/Unmodifiable.java b/src/main/java/org/apache/commons/collections4/Unmodifiable.java index 3541908d5b..df9d98486a 100644 --- a/src/main/java/org/apache/commons/collections4/Unmodifiable.java +++ b/src/main/java/org/apache/commons/collections4/Unmodifiable.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java b/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java index 9689d87b9e..a932fcff2c 100644 --- a/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java +++ b/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -38,6 +38,7 @@ public abstract class AbstractBagDecorator /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractBagDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java b/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java index 9da508f625..f64d19c933 100644 --- a/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/AbstractMapBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -121,6 +121,7 @@ protected static class MutableInteger { /** * Constructs a new instance. + * * @param value the initial value */ MutableInteger(final int value) { @@ -479,6 +480,7 @@ public boolean removeAll(final Collection coll) { /** * Remove any members of the bag that are not in the given bag, respecting * cardinality. + * * @see #retainAll(Collection) * @param other the bag to retain * @return {@code true} if this call changed the collection diff --git a/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java b/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java index 9685fc3d11..723fc65f9e 100644 --- a/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java +++ b/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -37,6 +37,7 @@ public abstract class AbstractSortedBagDecorator /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractSortedBagDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java b/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java index 4e25590eae..8610bc8101 100644 --- a/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java b/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java index f15ee50c2c..a9c1bc2414 100644 --- a/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/HashBag.java b/src/main/java/org/apache/commons/collections4/bag/HashBag.java index 1a6515b15c..b455cf1cae 100644 --- a/src/main/java/org/apache/commons/collections4/bag/HashBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/HashBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java b/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java index c538c125a2..f4fc89872f 100644 --- a/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java b/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java index d09f3a687d..b6a51fb6bf 100644 --- a/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java b/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java index 94d8742e59..ea95fb28ff 100644 --- a/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -41,11 +41,13 @@ public class SynchronizedBag extends SynchronizedCollection implements Bag * Synchronized Set for the Bag class. */ final class SynchronizedBagSet extends SynchronizedCollection implements Set { + /** Serialization version */ private static final long serialVersionUID = 2990565892366827855L; /** * Constructs a new instance. + * * @param set the set to decorate * @param lock the lock to use, shared with the bag */ diff --git a/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java b/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java index 83e398f156..dd0f9fe280 100644 --- a/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java b/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java index ada438425c..832bd2f39f 100644 --- a/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java b/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java index 6da66ecfaf..5c6408426b 100644 --- a/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/TreeBag.java b/src/main/java/org/apache/commons/collections4/bag/TreeBag.java index b94e70c6bc..9e1363273a 100644 --- a/src/main/java/org/apache/commons/collections4/bag/TreeBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/TreeBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java b/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java index 8a7cc901d9..a3b0263fa3 100644 --- a/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java b/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java index 697411a801..eac975f46a 100644 --- a/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java +++ b/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bag/package-info.java b/src/main/java/org/apache/commons/collections4/bag/package-info.java index aa1dca4710..cb8284af79 100644 --- a/src/main/java/org/apache/commons/collections4/bag/package-info.java +++ b/src/main/java/org/apache/commons/collections4/bag/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -23,18 +23,18 @@ * The following implementations are provided in the package: *

*
    - *
  • HashBag - implementation that uses a HashMap to store the data - *
  • TreeBag - implementation that uses a TreeMap to store the data + *
  • HashBag - implementation that uses a HashMap to store the data
  • + *
  • TreeBag - implementation that uses a TreeMap to store the data
  • *
*

* The following decorators are provided in the package: *

*
    - *
  • Synchronized - synchronizes method access for multithreaded environments - *
  • Unmodifiable - ensures the bag cannot be altered - *
  • Predicated - ensures that only elements that are valid according to a predicate can be added - *
  • Transformed - transforms each element added to the bag - *
  • Collection - ensures compliance with the java.util.Collection contract + *
  • Synchronized - synchronizes method access for multithreaded environments
  • + *
  • Unmodifiable - ensures the bag cannot be altered
  • + *
  • Predicated - ensures that only elements that are valid according to a predicate can be added
  • + *
  • Transformed - transforms each element added to the bag
  • + *
  • Collection - ensures compliance with the java.util.Collection contract
  • *
*/ package org.apache.commons.collections4.bag; diff --git a/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java b/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java index 0f622f77e6..7eb7314a4c 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/AbstractDualBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/AbstractDualBidiMap.java index c99878d044..333179cc4a 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/AbstractDualBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/AbstractDualBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -67,6 +67,7 @@ protected static class BidiMapIterator implements MapIterator, Reset /** * Constructs a new instance. + * * @param parent the parent map */ protected BidiMapIterator(final AbstractDualBidiMap parent) { @@ -210,6 +211,7 @@ protected static class EntrySetIterator extends AbstractIteratorDecorator< /** * Constructs a new instance. + * * @param iterator the iterator to decorate * @param parent the parent map */ @@ -298,6 +300,7 @@ protected static class KeySetIterator extends AbstractIteratorDecorator { /** * Constructs a new instance. + * * @param iterator the iterator to decorate * @param parent the parent map */ @@ -339,6 +342,7 @@ protected static class MapEntry extends AbstractMapEntryDecorator { /** * Constructs a new instance. + * * @param entry the entry to decorate * @param parent the parent map */ @@ -419,6 +423,7 @@ protected static class ValuesIterator extends AbstractIteratorDecorator { /** * Constructs a new instance. + * * @param iterator the iterator to decorate * @param parent the parent map */ @@ -742,6 +747,7 @@ public boolean isEmpty() { } // Map views + /** * Gets a keySet view of the map. * Changes made on the view are reflected in the map. @@ -758,6 +764,7 @@ public Set keySet() { } // BidiMap + /** * Obtains a {@code MapIterator} over the map. * The iterator implements {@link BidiMapIterator}. diff --git a/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java b/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java index 50f5c9a24f..13e9b97b29 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java b/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java index 57daaf59ad..7e0330d79e 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/DualHashBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/DualHashBidiMap.java index afd721797e..2baec86acc 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/DualHashBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/DualHashBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/DualLinkedHashBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/DualLinkedHashBidiMap.java index 34790f1bb5..f3f0dc6fac 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/DualLinkedHashBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/DualLinkedHashBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap.java index 5d51c62db9..e1fcbe5c94 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -78,6 +78,7 @@ protected static class BidiOrderedMapIterator implements OrderedMapIterato /** * Constructs a new instance. + * * @param parent the parent map */ protected BidiOrderedMapIterator(final AbstractDualBidiMap parent) { @@ -172,8 +173,10 @@ public String toString() { * @param the type of the values. */ protected static class ViewMap extends AbstractSortedMapDecorator { + /** * Constructs a new instance. + * * @param bidi the parent bidi map * @param sm the subMap sorted map */ diff --git a/src/main/java/org/apache/commons/collections4/bidimap/TreeBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/TreeBidiMap.java index 167cc8b36d..f04dcf93a9 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/TreeBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/TreeBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -95,6 +95,7 @@ abstract class AbstractView extends AbstractSet { /** * Constructs a new instance. + * * @param orderType the KEY or VALUE int for the order */ AbstractView(final DataElement orderType) { @@ -119,17 +120,22 @@ abstract class AbstractViewIterator { /** Whether to return KEY or VALUE order. */ private final DataElement orderType; + /** The last node returned by the iterator. */ Node lastReturnedNode; + /** The next node to be returned by the iterator. */ private Node nextNode; + /** The previous node in the sequence returned by the iterator. */ private Node previousNode; + /** The modification count. */ private int expectedModifications; /** * Constructs a new instance. + * * @param orderType the KEY or VALUE int for the order */ AbstractViewIterator(final DataElement orderType) { @@ -214,6 +220,7 @@ public String toString() { return description; } } + /** * A view of this map. */ @@ -254,6 +261,7 @@ public boolean remove(final Object obj) { return false; } } + /** * The inverse map implementation. */ @@ -261,8 +269,10 @@ final class Inverse implements OrderedBidiMap { /** Store the keySet once created. */ private Set inverseKeySet; + /** Store the valuesSet once created. */ private Set inverseValuesSet; + /** Store the entrySet once created. */ private Set> inverseEntrySet; @@ -407,6 +417,7 @@ public Set values() { return inverseValuesSet; } } + /** * A view of this map. */ @@ -447,6 +458,7 @@ public boolean remove(final Object obj) { return false; } } + /** * An iterator over the inverse map entries. */ @@ -473,6 +485,7 @@ public Map.Entry previous() { return createEntry(navigatePrevious()); } } + /** * An iterator over the map. */ diff --git a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java index 85e399af63..4390cc8a4e 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java index bc4e00ca50..f6c55e3633 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java index 83f2e8dd1a..aaf2c1a0c5 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bidimap/package-info.java b/src/main/java/org/apache/commons/collections4/bidimap/package-info.java index d5045feff7..3b447054a7 100644 --- a/src/main/java/org/apache/commons/collections4/bidimap/package-info.java +++ b/src/main/java/org/apache/commons/collections4/bidimap/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -27,16 +27,16 @@ * The following implementations are provided in the package: *

*
    - *
  • DualHashBidiMap - uses two HashMaps to implement BidiMap - *
  • DualLinkedHashBidiMap - uses two LinkedHashMaps to implement BidiMap - *
  • DualTreeBidiMap - uses two TreeMaps to implement SortedBidiMap - *
  • TreeBidiMap - red-black tree implementation of OrderedBidiMap + *
  • DualHashBidiMap - uses two HashMaps to implement BidiMap
  • + *
  • DualLinkedHashBidiMap - uses two LinkedHashMaps to implement BidiMap
  • + *
  • DualTreeBidiMap - uses two TreeMaps to implement SortedBidiMap
  • + *
  • TreeBidiMap - red-black tree implementation of OrderedBidiMap
  • *
*

* The following decorators are provided in the package: *

*
    - *
  • Unmodifiable - ensures the map cannot be altered + *
  • Unmodifiable - ensures the map cannot be altered
  • *
*/ package org.apache.commons.collections4.bidimap; diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java index 6ff4782a10..5b83376cd9 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/ArrayCountingBloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BitMapExtractor.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BitMapExtractor.java index 5c154268bd..fcb101e757 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/BitMapExtractor.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BitMapExtractor.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -94,6 +94,7 @@ static BitMapExtractor fromIndexExtractor(final IndexExtractor extractor, final * The default implementation of this method is slow. It is recommended * that implementing classes reimplement this method. *

+ * * @return An array of bit map data. */ default long[] asBitMapArray() { @@ -131,7 +132,7 @@ long[] toArray() { * arrays reimplement this method. *

* - * @param other The other BitMapExtractor that provides the y values in the (x,y) pair. + * @param other The other BitMapExtractor that provides the y values in the (x, y) pair. * @param func The function to apply. * @return A LongPredicate that tests this BitMapExtractor's bitmap values in order. */ diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BitMaps.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BitMaps.java index f809953a01..83c31bbec5 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/BitMaps.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BitMaps.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java index 338c8300e8..b006e5317c 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -232,6 +232,7 @@ default int estimateUnion(final BloomFilter other) { /** * Gets the shape that was used when the filter was built. + * * @return The shape the filter was built with. */ Shape getShape(); diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterExtractor.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterExtractor.java index 9d32964b9d..a7e27fc0ef 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterExtractor.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterExtractor.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -120,7 +120,7 @@ default BloomFilter flatten() { * instances, or references to the filters in the collection. *

* - * @param other The other BloomFilterExtractor that provides the y values in the (x,y) pair. + * @param other The other BloomFilterExtractor that provides the y values in the (x, y) pair. * @param func The function to apply. * @return {@code true} if the {@code func} returned {@code true} for every pair, {@code false} otherwise. */ diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CellExtractor.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CellExtractor.java index f9f63bbedc..2536d94b19 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CellExtractor.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CellExtractor.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -51,6 +51,7 @@ public interface CellExtractor extends IndexExtractor { */ @FunctionalInterface interface CellPredicate { + /** * Performs an operation on the given {@code } pair. * @@ -70,7 +71,7 @@ interface CellPredicate { *
  • The CellExtractor aggregates duplicate indices from the IndexExtractor.
  • * * - *

    A CellExtractor that outputs the mapping [(1,2),(2,3),(3,1)] can be created from many combinations + *

    A CellExtractor that outputs the mapping [(1, 2),(2, 3),(3, 1)] can be created from many combinations * of indices including:

    *
          * [1, 1, 2, 2, 2, 3]
    @@ -84,6 +85,7 @@ interface CellPredicate {
          */
         static CellExtractor from(final IndexExtractor indexExtractor) {
             return new CellExtractor() {
    +
                 /**
                  * Class to track cell values in the TreeMap.
                  */
    diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
    index a8bb7e8f1a..0a1dbed676 100644
    --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
    +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java
    @@ -6,7 +6,7 @@
      * (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
    + *      https://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,
    @@ -234,6 +234,7 @@ default boolean merge(final Hasher hasher) {
          * to a CellExtractor and add that.
          * 
  • Implementations should throw {@code IllegalArgumentException} and no other exception on bad input.
  • * + * * @param indexExtractor the IndexExtractor * @return {@code true} if the removal was successful and the state is valid * @see #isValid() @@ -348,6 +349,7 @@ default boolean remove(final IndexExtractor indexExtractor) { /** * The default implementation is a no-op since the counting bloom filter returns an unique IndexExtractor by default. + * * @return this counting Bloom filter. */ @Override diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java index 3f32b1a695..9c5f717c99 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingPredicate.java b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingPredicate.java index cbf0f4aacc..cfc3680426 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingPredicate.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/EnhancedDoubleHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/EnhancedDoubleHasher.java index 3f12e4762d..3719eb8153 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/EnhancedDoubleHasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/EnhancedDoubleHasher.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/Hasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/Hasher.java index 583da2a760..6a41dc993d 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/Hasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/Hasher.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexExtractor.java b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexExtractor.java index 4066c9c32c..da87d845af 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexExtractor.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexExtractor.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilter.java index b67a2aa23d..646093f298 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -32,6 +32,7 @@ public final class IndexFilter { /** * An IndexTracker implementation that uses an array of integers to track whether or not a * number has been seen. Suitable for Shapes that have few hash functions. + * * @since 4.5.0 */ static class ArrayTracker implements IntPredicate { @@ -40,6 +41,7 @@ static class ArrayTracker implements IntPredicate { /** * Constructs the tracker based on the shape. + * * @param shape the shape to build the tracker for. */ ArrayTracker(final Shape shape) { @@ -70,6 +72,7 @@ static class BitMapTracker implements IntPredicate { /** * Constructs a bit map based tracker for the specified shape. + * * @param shape The shape that is being generated. */ BitMapTracker(final Shape shape) { diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java index 09969d5981..929ee977a9 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java index d6111c5dc8..7aa9b1c590 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -138,7 +138,7 @@ public static > Consumer> noCleanup() { } /** - * Removes the earliest filters in the list when the the number of filters + * Removes the earliest filters in the list when the number of filters * exceeds maxSize. * * @param Type of BloomFilter. @@ -292,7 +292,7 @@ public static > Builder builder() { /** * Constructs a new instance. * - * @param filterSupplier the non-null supplier of new Bloom filters to add the the list + * @param filterSupplier the non-null supplier of new Bloom filters to add the list * when necessary. * @param extendCheck The non-null predicate that checks if a new filter should be * added to the list. @@ -361,6 +361,7 @@ public LayerManager copy() { /** * Gets the Bloom filter from the first layer. * No extension check is performed during this call. + * * @return The Bloom filter from the first layer. * @see #getTarget() */ diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilter.java index 0f04e80cf9..5d0531c50e 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -45,7 +45,7 @@ *
      *
    • Level 0 is the oldest layer and the highest level is the newest.
    • *
    • There is always at least one enclosed filter.
    • - *
    • The newest filter is the {@code target} into which merges are performed. + *
    • The newest filter is the {@code target} into which merges are performed.
    • *
    • Whenever the target is retrieved, or a {@code merge} operation is performed the code checks if any older layers should be removed, and if so removes * them. It also checks it a new layer should be added, and if so adds it and sets the {@code target} before the operation.
    • *
    diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/LongBiPredicate.java b/src/main/java/org/apache/commons/collections4/bloomfilter/LongBiPredicate.java index 7df82bfb13..9d36ed692c 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/LongBiPredicate.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/LongBiPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -20,7 +20,7 @@ * Represents a function that accepts a two long-valued argument and produces a binary result. * This is the long-consuming primitive specialization for {@code BiPredicate}. *

    - * This is a functional interface whose functional method is {@code test(long,long)}. + * This is a functional interface whose functional method is {@code test(long, long)}. *

    * * @since 4.5.0-M1 diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/SetOperations.java b/src/main/java/org/apache/commons/collections4/bloomfilter/SetOperations.java index a06ef01bda..e7ee2f10a1 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/SetOperations.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/SetOperations.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java b/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java index 44599e2f33..def931422e 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilter.java index 9b81ce3d57..fd40da0b63 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/SimpleBloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java index 1aca8f7ac5..c27f1c2912 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/SparseBloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilter.java index 84dd88ba95..ddf89ac970 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilter.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilter.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/package-info.java b/src/main/java/org/apache/commons/collections4/bloomfilter/package-info.java index ad41d5b9d2..eb9ea3938a 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/package-info.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java b/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java index 493ff73276..e764eb5566 100644 --- a/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java +++ b/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -67,6 +67,7 @@ public abstract class AbstractCollectionDecorator /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractCollectionDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java b/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java index 0c2724c4cc..d89db8d669 100644 --- a/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -37,6 +37,7 @@ * Add and remove operations require the use of a pluggable strategy. If no * strategy is provided then add and remove are unsupported. *

    + * * @param the type of the elements in the collection * @since 3.0 */ @@ -228,6 +229,7 @@ public void addComposited(final Collection compositeCollection1, *

    * This implementation calls {@code clear()} on each collection. *

    + * * @throws UnsupportedOperationException if clear is unsupported */ @Override @@ -242,6 +244,7 @@ public void clear() { *

    * This implementation calls {@code contains()} on each collection. *

    + * * @param obj the object to search for * @return true if obj is contained in any of the contained collections */ @@ -261,6 +264,7 @@ public boolean contains(final Object obj) { * This implementation calls {@code contains()} for each element in the * specified collection. *

    + * * @param coll the collection to check for * @return true if all elements contained */ @@ -288,6 +292,7 @@ public List> getCollections() { /** * Gets the collection mutator to be used for this CompositeCollection. + * * @return CollectionMutator<E> */ protected CollectionMutator getMutator() { @@ -299,6 +304,7 @@ protected CollectionMutator getMutator() { *

    * This implementation calls {@code isEmpty()} on each collection. *

    + * * @return true if all of the contained collections are empty */ @Override @@ -316,6 +322,7 @@ public boolean isEmpty() { *

    * This implementation uses an {@code IteratorChain}. *

    + * * @return an {@code IteratorChain} instance which supports * {@code remove()}. Iteration occurs over contained collections in * the order they were added, but this behavior should not be relied upon. @@ -356,6 +363,7 @@ public boolean remove(final Object obj) { *

    * This implementation calls {@code removeAll} on each collection. *

    + * * @param coll the collection to remove * @return true if the collection was modified * @throws UnsupportedOperationException if removeAll is unsupported @@ -386,6 +394,7 @@ public void removeComposited(final Collection coll) { *

    * This implementation calls {@code removeIf} on each collection. *

    + * * @param filter a predicate which returns true for elements to be removed * @return true if the collection was modified * @throws UnsupportedOperationException if removeIf is unsupported @@ -409,6 +418,7 @@ public boolean removeIf(final Predicate filter) { *

    * This implementation calls {@code retainAll()} on each collection. *

    + * * @param coll the collection to remove * @return true if the collection was modified * @throws UnsupportedOperationException if retainAll is unsupported @@ -438,6 +448,7 @@ public void setMutator(final CollectionMutator mutator) { *

    * This implementation calls {@code size()} on each collection. *

    + * * @return total number of elements in all contained containers */ @Override diff --git a/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java b/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java index 17084b2b67..c76fd33e1b 100644 --- a/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java b/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java index 588c86a08e..24743f0c60 100644 --- a/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java b/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java index 32ef9a78f8..dbe9d50d9f 100644 --- a/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -58,6 +58,7 @@ public class SynchronizedCollection implements Collection, Serializable { public static SynchronizedCollection synchronizedCollection(final Collection coll) { return new SynchronizedCollection<>(coll); } + /** The collection to decorate */ private final Collection collection; diff --git a/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java b/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java index 456b33a53e..e101b5a712 100644 --- a/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java b/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java index d15e9b7e26..54cb900731 100644 --- a/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java b/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java index 1e3768ca13..f2c6bc6223 100644 --- a/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/collection/package-info.java b/src/main/java/org/apache/commons/collections4/collection/package-info.java index 67b501cb17..6958e97e23 100644 --- a/src/main/java/org/apache/commons/collections4/collection/package-info.java +++ b/src/main/java/org/apache/commons/collections4/collection/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -20,16 +20,19 @@ * {@link java.util.Collection Collection} interface. *

    * The following implementations are provided in the package: + *

    *
      - *
    • CompositeCollection - a collection that combines multiple collections into one + *
    • CompositeCollection - a collection that combines multiple collections into one
    • *
    + *

    * The following decorators are provided in the package: + *

    *
      - *
    • Synchronized - synchronizes method access for multithreaded environments - *
    • Unmodifiable - ensures the collection cannot be altered - *
    • Predicated - ensures that only elements that are valid according to a predicate can be added - *
    • Transformed - transforms elements as they are added - *
    • Indexed - provides a map-like view onto another collection + *
    • Synchronized - synchronizes method access for multithreaded environments
    • + *
    • Unmodifiable - ensures the collection cannot be altered
    • + *
    • Predicated - ensures that only elements that are valid according to a predicate can be added
    • + *
    • Transformed - transforms elements as they are added
    • + *
    • Indexed - provides a map-like view onto another collection
    • *
    */ package org.apache.commons.collections4.collection; diff --git a/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java b/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java index 83c61c05e7..429c1af745 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/BooleanComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -176,7 +176,7 @@ public int hashCode() { * I sort {@code true} values before * {@code false} values. In other words, * returns {@code true} iff - * {@link #compare(Boolean,Boolean) compare(Boolean.FALSE,Boolean.TRUE)} + * {@link #compare(Boolean,Boolean) compare(Boolean.FALSE, Boolean.TRUE)} * returns a positive value. * * @return the trueFirst flag diff --git a/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java b/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java index 82e64a1912..0224a3f14b 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java b/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java index 947eec6330..253ddce5b3 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java +++ b/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -58,15 +58,17 @@ public class ComparatorChain implements Comparator, Serializable { /** The list of comparators in the chain. */ private final List> comparatorChain; + /** Order - false (clear) = ascend; true (set) = descend. */ private final BitSet orderingBits; - /** Whether the chain has been "locked". */ + + /** Whether the chain has been "locked". */ private boolean isLocked; /** * Constructs a ComparatorChain with no Comparators. * You must add at least one Comparator before calling - * the compare(Object,Object) method, or an + * the compare(Object, Object) method, or an * UnsupportedOperationException is thrown */ public ComparatorChain() { @@ -182,7 +184,7 @@ private void checkLocked() { /** * Perform comparisons on the Objects as per - * Comparator.compare(o1,o2). + * Comparator.compare(o1, o2). * * @param o1 the first object to compare * @param o2 the second object to compare diff --git a/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java b/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java index 0952beea06..fa9b3a25a6 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -90,7 +90,6 @@ public enum UnknownObjectBehavior { /** The behavior in the case of an unknown object */ private UnknownObjectBehavior unknownObjectBehavior = UnknownObjectBehavior.EXCEPTION; - // Constructors /** * Constructs an empty FixedOrderComparator. */ @@ -127,7 +126,6 @@ public FixedOrderComparator(final T... items) { } } - // Methods for adding items /** * Adds an item, which compares as after all items known to the Comparator. * If the item is already known to the Comparator, its old position is @@ -178,7 +176,6 @@ protected void checkLocked() { } } - // Comparator methods /** * Compares two objects according to the order of this Comparator. *

    @@ -245,7 +242,6 @@ public int hashCode() { return Objects.hash(counter, isLocked, map, unknownObjectBehavior); } - // Bean methods / state querying methods /** * Returns true if modifications cannot be made to the FixedOrderComparator. * FixedOrderComparators cannot be modified once they have performed a comparison. diff --git a/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java b/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java index 8db6b07b70..b38c6203b1 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/NullComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -35,99 +35,96 @@ public class NullComparator implements Comparator, Serializable { private static final long serialVersionUID = -5820772575483504339L; /** - * The comparator to use when comparing two non-{@code null} objects. - **/ + * The comparator to use when comparing two non-{@code null} objects. + */ private final Comparator nonNullComparator; /** - * Specifies whether a {@code null} are compared as higher than - * non-{@code null} objects. - **/ + * Specifies whether a {@code null} are compared as higher than + * non-{@code null} objects. + */ private final boolean nullsAreHigh; /** - * Construct an instance that sorts {@code null} higher than any - * non-{@code null} object it is compared with. When comparing two - * non-{@code null} objects, the {@link ComparableComparator} is - * used. - **/ + * Construct an instance that sorts {@code null} higher than any + * non-{@code null} object it is compared with. When comparing two + * non-{@code null} objects, the {@link ComparableComparator} is + * used. + */ public NullComparator() { this(ComparatorUtils.NATURAL_COMPARATOR, true); } /** - * Construct an instance that sorts {@code null} higher or lower than - * any non-{@code null} object it is compared with. When comparing - * two non-{@code null} objects, the {@link ComparableComparator} is - * used. + * Construct an instance that sorts {@code null} higher or lower than + * any non-{@code null} object it is compared with. When comparing + * two non-{@code null} objects, the {@link ComparableComparator} is + * used. * - * @param nullsAreHigh a {@code true} value indicates that - * {@code null} should be compared as higher than a - * non-{@code null} object. A {@code false} value indicates - * that {@code null} should be compared as lower than a - * non-{@code null} object. - **/ + * @param nullsAreHigh a {@code true} value indicates that + * {@code null} should be compared as higher than a + * non-{@code null} object. A {@code false} value indicates + * that {@code null} should be compared as lower than a + * non-{@code null} object. + */ public NullComparator(final boolean nullsAreHigh) { this(ComparatorUtils.NATURAL_COMPARATOR, nullsAreHigh); } /** - * Construct an instance that sorts {@code null} higher than any - * non-{@code null} object it is compared with. When comparing two - * non-{@code null} objects, the specified {@link Comparator} is - * used. + * Construct an instance that sorts {@code null} higher than any + * non-{@code null} object it is compared with. When comparing two + * non-{@code null} objects, the specified {@link Comparator} is + * used. * - * @param nonNullComparator the comparator to use when comparing two - * non-{@code null} objects. This argument cannot be - * {@code null} - * - * @throws NullPointerException if {@code nonNullComparator} is - * {@code null} - **/ + * @param nonNullComparator the comparator to use when comparing two + * non-{@code null} objects. This argument cannot be + * {@code null} + * @throws NullPointerException if {@code nonNullComparator} is + * {@code null} + */ public NullComparator(final Comparator nonNullComparator) { this(nonNullComparator, true); } /** - * Construct an instance that sorts {@code null} higher or lower than - * any non-{@code null} object it is compared with. When comparing - * two non-{@code null} objects, the specified {@link Comparator} is - * used. - * - * @param nonNullComparator the comparator to use when comparing two - * non-{@code null} objects. This argument cannot be - * {@code null} + * Construct an instance that sorts {@code null} higher or lower than + * any non-{@code null} object it is compared with. When comparing + * two non-{@code null} objects, the specified {@link Comparator} is + * used. * - * @param nullsAreHigh a {@code true} value indicates that - * {@code null} should be compared as higher than a - * non-{@code null} object. A {@code false} value indicates - * that {@code null} should be compared as lower than a - * non-{@code null} object. - * - * @throws NullPointerException if {@code nonNullComparator} is - * {@code null} - **/ + * @param nonNullComparator the comparator to use when comparing two + * non-{@code null} objects. This argument cannot be + * {@code null} + * @param nullsAreHigh a {@code true} value indicates that + * {@code null} should be compared as higher than a + * non-{@code null} object. A {@code false} value indicates + * that {@code null} should be compared as lower than a + * non-{@code null} object. + * @throws NullPointerException if {@code nonNullComparator} is + * {@code null} + */ public NullComparator(final Comparator nonNullComparator, final boolean nullsAreHigh) { this.nonNullComparator = Objects.requireNonNull(nonNullComparator, "nonNullComparator"); this.nullsAreHigh = nullsAreHigh; } /** - * Perform a comparison between two objects. If both objects are - * {@code null}, a {@code 0} value is returned. If one object - * is {@code null} and the other is not, the result is determined on - * whether the Comparator was constructed to have nulls as higher or lower - * than other objects. If neither object is {@code null}, an - * underlying comparator specified in the constructor (or the default) is - * used to compare the non-{@code null} objects. + * Perform a comparison between two objects. If both objects are + * {@code null}, a {@code 0} value is returned. If one object + * is {@code null} and the other is not, the result is determined on + * whether the Comparator was constructed to have nulls as higher or lower + * than other objects. If neither object is {@code null}, an + * underlying comparator specified in the constructor (or the default) is + * used to compare the non-{@code null} objects. * - * @param o1 the first object to compare - * @param o2 the object to compare it to. - * @return {@code -1} if {@code o1} is "lower" than (less than, - * before, etc.) {@code o2}; {@code 1} if {@code o1} is - * "higher" than (greater than, after, etc.) {@code o2}; or - * {@code 0} if {@code o1} and {@code o2} are equal. - **/ + * @param o1 the first object to compare + * @param o2 the object to compare it to. + * @return {@code -1} if {@code o1} is "lower" than (less than, + * before, etc.) {@code o2}; {@code 1} if {@code o1} is + * "higher" than (greater than, after, etc.) {@code o2}; or + * {@code 0} if {@code o1} and {@code o2} are equal. + */ @Override public int compare(final E o1, final E o2) { if (o1 == o2) { @@ -143,16 +140,15 @@ public int compare(final E o1, final E o2) { } /** - * Determines whether the specified object represents a comparator that is - * equal to this comparator. - * - * @param obj the object to compare this comparator with. + * Determines whether the specified object represents a comparator that is + * equal to this comparator. * - * @return {@code true} if the specified object is a NullComparator - * with equivalent {@code null} comparison behavior - * (i.e. {@code null} high or low) and with equivalent underlying - * non-{@code null} object comparators. - **/ + * @param obj the object to compare this comparator with. + * @return {@code true} if the specified object is a NullComparator + * with equivalent {@code null} comparison behavior + * (i.e. {@code null} high or low) and with equivalent underlying + * non-{@code null} object comparators. + */ @Override public boolean equals(final Object obj) { if (obj == null) { @@ -172,11 +168,11 @@ public boolean equals(final Object obj) { } /** - * Implement a hash code for this comparator that is consistent with - * {@link #equals(Object)}. + * Implement a hash code for this comparator that is consistent with + * {@link #equals(Object)}. * - * @return a hash code for this comparator. - **/ + * @return a hash code for this comparator. + */ @Override public int hashCode() { return (nullsAreHigh ? -1 : 1) * nonNullComparator.hashCode(); diff --git a/src/main/java/org/apache/commons/collections4/comparators/ReverseComparator.java b/src/main/java/org/apache/commons/collections4/comparators/ReverseComparator.java index bdbf297dd8..27cdd69cd2 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/ReverseComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/ReverseComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java b/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java index 217aa3a597..54f78e0b58 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/comparators/package-info.java b/src/main/java/org/apache/commons/collections4/comparators/package-info.java index a78493381c..b5c0742e45 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/package-info.java +++ b/src/main/java/org/apache/commons/collections4/comparators/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/AbstractPredicate.java b/src/main/java/org/apache/commons/collections4/functors/AbstractPredicate.java index 3cc1f956e7..d091bd6321 100644 --- a/src/main/java/org/apache/commons/collections4/functors/AbstractPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/AbstractPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -19,7 +19,7 @@ import org.apache.commons.collections4.Predicate; /** - * Abstract base class for predicates. + * Abstract class for predicates. * * @param the type of the input to the predicate. * @since 4.5.0-M3 diff --git a/src/main/java/org/apache/commons/collections4/functors/AbstractQuantifierPredicate.java b/src/main/java/org/apache/commons/collections4/functors/AbstractQuantifierPredicate.java index 0e5e1e352a..062799ddfb 100644 --- a/src/main/java/org/apache/commons/collections4/functors/AbstractQuantifierPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/AbstractQuantifierPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -21,7 +21,7 @@ import org.apache.commons.collections4.Predicate; /** - * Abstract base class for quantification predicates, for example All, Any, None. + * Abstract class for quantification predicates, for example All, Any, None. * * @param the type of the input to the predicate. * @since 4.0 diff --git a/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java b/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java index 1722e452d7..bcbf38a106 100644 --- a/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java b/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java index d1bffe8d9e..5c21374510 100644 --- a/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -46,6 +46,7 @@ public static Predicate andPredicate(final Predicate predicate return new AndPredicate<>(Objects.requireNonNull(predicate1, "predicate1"), Objects.requireNonNull(predicate2, "predicate2")); } + /** The array of predicates to call */ private final Predicate iPredicate1; diff --git a/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java b/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java index 9484b85981..5ce2545558 100644 --- a/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/CatchAndRethrowClosure.java b/src/main/java/org/apache/commons/collections4/functors/CatchAndRethrowClosure.java index 5dc22f54ae..2dfd37d3d8 100644 --- a/src/main/java/org/apache/commons/collections4/functors/CatchAndRethrowClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/CatchAndRethrowClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java b/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java index 784cab9dd4..b79caccdcd 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java index 8e7e45090d..e9ca4f253e 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java b/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java index 32a0b87740..9ee8c3c11e 100644 --- a/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java index 411ab1fd16..6a79999b86 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java b/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java index b399d82966..9e19499f84 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java b/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java index 5785a97985..64b01f298b 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java index b2362549ea..7e51e3e689 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java index 59a5d3feaa..b5b283ee56 100644 --- a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java +++ b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/EqualPredicate.java b/src/main/java/org/apache/commons/collections4/functors/EqualPredicate.java index b59379e4ad..a7f798a6eb 100644 --- a/src/main/java/org/apache/commons/collections4/functors/EqualPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/EqualPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java index 58e91c64b9..5b7fa3c8ba 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java index 9b1bc4c4a2..e827d83e03 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java index e0c4e459b7..14f36ec420 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java index 52429a0da0..3fa2690621 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java b/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java index 203c7e0906..5def6b94c5 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java index 8cf0f4b452..931325ef94 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/ForClosure.java b/src/main/java/org/apache/commons/collections4/functors/ForClosure.java index 7abb4d7971..8fc4f58011 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ForClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/ForClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -53,6 +53,7 @@ public static Closure forClosure(final int count, final Closure(count, closure); } + /** The number of times to loop */ private final int iCount; diff --git a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java index 6209735c7a..a588ae052e 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java +++ b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -30,6 +30,17 @@ */ final class FunctorUtils { + /** + * Clones the given array or returns null on null input. + * + * @param The array type. + * @param array The array to clone. + * @return The cloned array or null. + */ + private static T[] clone(final T... array) { + return array != null ? array.clone() : null; + } + /** * A very simple method that coerces Predicate to Predicate. * Due to the {@link Predicate#test(T)} method, Predicate is @@ -75,10 +86,7 @@ static , P extends java.util.function. */ @SuppressWarnings("unchecked") static > T[] copy(final T... consumers) { - if (consumers == null) { - return null; - } - return consumers.clone(); + return clone(consumers); } /** @@ -91,10 +99,7 @@ static > T[] copy(final T... consumers) { */ @SuppressWarnings("unchecked") static > T[] copy(final T... predicates) { - if (predicates == null) { - return null; - } - return predicates.clone(); + return clone(predicates); } /** @@ -105,10 +110,7 @@ static > T[] copy(final T... predicate */ @SuppressWarnings("unchecked") static > T[] copy(final T... transformers) { - if (transformers == null) { - return null; - } - return transformers.clone(); + return clone(transformers); } /** @@ -139,7 +141,7 @@ static Predicate[] validate(final Collection... consumers) { - Objects.requireNonNull(consumers, "closures"); + Objects.requireNonNull(consumers, "consumers"); for (int i = 0; i < consumers.length; i++) { if (consumers[i] == null) { throw new NullPointerException("closures[" + i + "]"); diff --git a/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java b/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java index 21522a4ae6..611ebadd5f 100644 --- a/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/IfClosure.java b/src/main/java/org/apache/commons/collections4/functors/IfClosure.java index 886127a096..54072b79bc 100644 --- a/src/main/java/org/apache/commons/collections4/functors/IfClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/IfClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -50,6 +50,7 @@ public class IfClosure implements Closure, Serializable { public static Closure ifClosure(final Predicate predicate, final Closure trueClosure) { return IfClosure.ifClosure(predicate, trueClosure, NOPClosure.nopClosure()); } + /** * Factory method that performs validation. * @@ -67,6 +68,7 @@ public static Closure ifClosure(final Predicate predicate, Objects.requireNonNull(trueClosure, "trueClosure"), Objects.requireNonNull(falseClosure, "falseClosure")); } + /** The test */ private final Predicate iPredicate; diff --git a/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java b/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java index 366753db3a..7743c5337a 100644 --- a/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -53,6 +53,7 @@ public static Transformer ifTransformer(final Predicate Objects.requireNonNull(trueTransformer, "trueTransformer"), Objects.requireNonNull(falseTransformer, "falseTransformer")); } + /** * Factory method that performs validation. *

    @@ -71,6 +72,7 @@ public static Transformer ifTransformer( return new IfTransformer<>(Objects.requireNonNull(predicate, "predicate"), Objects.requireNonNull(trueTransformer, "trueTransformer"), NOPTransformer.nopTransformer()); } + /** The test */ private final Predicate iPredicate; diff --git a/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java b/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java index 06b74fde55..9e4fdae7e3 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java b/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java index 72b1c58030..e8f2d22756 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -63,10 +63,13 @@ public static Factory instantiateFactory(final Class classToInstantiat } return new InstantiateFactory<>(classToInstantiate, paramTypes, args); } + /** The class to create */ private final Class iClassToInstantiate; + /** The constructor parameter types */ private final Class[] iParamTypes; + /** The constructor arguments */ private final Object[] iArgs; diff --git a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java index 6f7ec6ca86..18361e5c19 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -49,6 +49,7 @@ public class InstantiateTransformer implements Transformer public static Transformer, T> instantiateTransformer() { return NO_ARG_INSTANCE; } + /** * Transformer method that performs validation. * diff --git a/src/main/java/org/apache/commons/collections4/functors/InvokerTransformer.java b/src/main/java/org/apache/commons/collections4/functors/InvokerTransformer.java index 5ed076953a..263a306d09 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InvokerTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/InvokerTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -51,6 +51,7 @@ public class InvokerTransformer implements Transformer { public static Transformer invokerTransformer(final String methodName) { return new InvokerTransformer<>(Objects.requireNonNull(methodName, "methodName")); } + /** * Gets an instance of this transformer calling a specific method with specific values. * @@ -76,6 +77,7 @@ public static Transformer invokerTransformer(final String methodNam } return new InvokerTransformer<>(methodName, paramTypes, args); } + /** The method name to call */ private final String iMethodName; diff --git a/src/main/java/org/apache/commons/collections4/functors/MapTransformer.java b/src/main/java/org/apache/commons/collections4/functors/MapTransformer.java index af94dac1fa..a5b63a3e16 100644 --- a/src/main/java/org/apache/commons/collections4/functors/MapTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/MapTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java index 1c3feac491..7b6543fc45 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java index 29ab745225..8c05f12ec8 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NonePredicate.java b/src/main/java/org/apache/commons/collections4/functors/NonePredicate.java index 9788c0e238..4649622184 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NonePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NonePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java index dc9d4e6333..97092c30f0 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NotPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NotPredicate.java index 228b5a545f..62b14e80c8 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NotPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NotPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NullIsExceptionPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullIsExceptionPredicate.java index dae91a2f9e..a63d552001 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullIsExceptionPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullIsExceptionPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NullIsFalsePredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullIsFalsePredicate.java index 5ad285975b..bcec3baa21 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullIsFalsePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullIsFalsePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NullIsTruePredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullIsTruePredicate.java index 19d695f4ba..4f3d776d98 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullIsTruePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullIsTruePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java index 70f6b529da..bc7d2dd9a8 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/OnePredicate.java b/src/main/java/org/apache/commons/collections4/functors/OnePredicate.java index 0213793896..da06d3e262 100644 --- a/src/main/java/org/apache/commons/collections4/functors/OnePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/OnePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/OrPredicate.java b/src/main/java/org/apache/commons/collections4/functors/OrPredicate.java index b547cd229e..92572a5831 100644 --- a/src/main/java/org/apache/commons/collections4/functors/OrPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/OrPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -46,6 +46,7 @@ public static Predicate orPredicate(final Predicate predicate1 return new OrPredicate<>(Objects.requireNonNull(predicate1, "predicate1"), Objects.requireNonNull(predicate2, "predicate2")); } + /** The array of predicates to call */ private final Predicate iPredicate1; diff --git a/src/main/java/org/apache/commons/collections4/functors/PredicateDecorator.java b/src/main/java/org/apache/commons/collections4/functors/PredicateDecorator.java index 8cf2699132..b8dc9aa198 100644 --- a/src/main/java/org/apache/commons/collections4/functors/PredicateDecorator.java +++ b/src/main/java/org/apache/commons/collections4/functors/PredicateDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/PredicateTransformer.java b/src/main/java/org/apache/commons/collections4/functors/PredicateTransformer.java index 00fa8f0dc2..4bc9076e96 100644 --- a/src/main/java/org/apache/commons/collections4/functors/PredicateTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/PredicateTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java index 36cd29c12b..5c1fada974 100644 --- a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -51,6 +51,7 @@ static class PrototypeCloneFactory implements Factory { /** The object to clone each time */ private final T iPrototype; + /** The method used to clone */ private transient Method iCloneMethod; diff --git a/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java b/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java index 31c3fa3aa5..36f5ed693c 100644 --- a/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java b/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java index d623f1cf46..2d20c1ad15 100644 --- a/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -72,6 +72,7 @@ public static Closure switchClosure(final Map, Closure> p } return new SwitchClosure<>(false, preds, closures, defaultClosure); } + /** * Factory method that performs validation and copies the parameter arrays. * @@ -98,6 +99,7 @@ public static Closure switchClosure(final Predicate[] predicat } return new SwitchClosure<>(predicates, closures, defaultClosure); } + /** The tests to consider */ private final Predicate[] iPredicates; diff --git a/src/main/java/org/apache/commons/collections4/functors/SwitchTransformer.java b/src/main/java/org/apache/commons/collections4/functors/SwitchTransformer.java index 4262bf0ed5..213d1d5b95 100644 --- a/src/main/java/org/apache/commons/collections4/functors/SwitchTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/SwitchTransformer.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -81,6 +81,7 @@ public static Transformer switchTransformer( } return new SwitchTransformer<>(false, preds, transformers, defaultTransformer); } + /** * Factory method that performs validation and copies the parameter arrays. * @@ -109,6 +110,7 @@ public static Transformer switchTransformer(final Predicate(predicates, transformers, defaultTransformer); } + /** The tests to consider */ private final Predicate[] iPredicates; diff --git a/src/main/java/org/apache/commons/collections4/functors/TransformedPredicate.java b/src/main/java/org/apache/commons/collections4/functors/TransformedPredicate.java index 6aa2b86017..b30cfc5dc9 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TransformedPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/TransformedPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/TransformerClosure.java b/src/main/java/org/apache/commons/collections4/functors/TransformerClosure.java index 6d47fde5a5..e22c54b5ee 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TransformerClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/TransformerClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/TransformerPredicate.java b/src/main/java/org/apache/commons/collections4/functors/TransformerPredicate.java index 4e7c91efbe..aec7befa78 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TransformerPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/TransformerPredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java index b333ea050f..56cffc4d5c 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/UniquePredicate.java b/src/main/java/org/apache/commons/collections4/functors/UniquePredicate.java index 72906f1d08..6069085d81 100644 --- a/src/main/java/org/apache/commons/collections4/functors/UniquePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/UniquePredicate.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/functors/WhileClosure.java b/src/main/java/org/apache/commons/collections4/functors/WhileClosure.java index cb4386214a..cd9f984f58 100644 --- a/src/main/java/org/apache/commons/collections4/functors/WhileClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/WhileClosure.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -51,8 +51,10 @@ public static Closure whileClosure(final Predicate predicate, return new WhileClosure<>(Objects.requireNonNull(predicate, "predicate"), Objects.requireNonNull(closure, "closure"), doLoop); } + /** The test condition */ private final Predicate iPredicate; + /** The closure to call */ private final Closure iClosure; diff --git a/src/main/java/org/apache/commons/collections4/functors/package-info.java b/src/main/java/org/apache/commons/collections4/functors/package-info.java index 545e754c1f..1724839cdd 100644 --- a/src/main/java/org/apache/commons/collections4/functors/package-info.java +++ b/src/main/java/org/apache/commons/collections4/functors/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyIterator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyIterator.java index 72441b6c89..9c5048d58a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyMapIterator.java index 4baec53a01..9bee41054a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractEmptyMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractIteratorDecorator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractIteratorDecorator.java index b40a171039..c318721d0f 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractIteratorDecorator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractIteratorDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractListIteratorDecorator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractListIteratorDecorator.java index 9bd6ca5a1a..204513bddc 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractListIteratorDecorator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractListIteratorDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractMapIteratorDecorator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractMapIteratorDecorator.java index a2985c46c1..f347f3f55a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractMapIteratorDecorator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractMapIteratorDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractOrderedMapIteratorDecorator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractOrderedMapIteratorDecorator.java index 154d7b13f3..c93d6a1536 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractOrderedMapIteratorDecorator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractOrderedMapIteratorDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/AbstractUntypedIteratorDecorator.java b/src/main/java/org/apache/commons/collections4/iterators/AbstractUntypedIteratorDecorator.java index a360a229be..865b1bf5d8 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/AbstractUntypedIteratorDecorator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/AbstractUntypedIteratorDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java index f0c178d30e..b19a8ec53c 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ArrayIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -41,10 +41,13 @@ public class ArrayIterator implements ResettableIterator { /** The array to iterate over */ final Object array; + /** The start index to loop from */ final int startIndex; + /** The end index to loop to */ final int endIndex; + /** The current iterator index */ int index; diff --git a/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java index 1e409e37f4..b85f7565dd 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ArrayListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/BoundedIterator.java b/src/main/java/org/apache/commons/collections4/iterators/BoundedIterator.java index fa8756904c..300910b442 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/BoundedIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/BoundedIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -82,6 +82,7 @@ public BoundedIterator(final Iterator iterator, final long offset, /** * Checks whether the iterator is still within its bounded range. + * * @return {@code true} if the iterator is within its bounds, {@code false} otherwise */ private boolean checkBounds() { diff --git a/src/main/java/org/apache/commons/collections4/iterators/CartesianProductIterator.java b/src/main/java/org/apache/commons/collections4/iterators/CartesianProductIterator.java index b4d4a3995c..fc51cc79b8 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/CartesianProductIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/CartesianProductIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java index 54c1c2060f..6ebe79d8ac 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/CollatingIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/EmptyIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EmptyIterator.java index d963b8d615..791742f96b 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EmptyIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EmptyIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/EmptyListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EmptyListIterator.java index d0370948ea..bd95ca59ed 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EmptyListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EmptyListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/EmptyMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EmptyMapIterator.java index 3a6d78e6c0..1aac23f18b 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EmptyMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EmptyMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -30,6 +30,7 @@ public class EmptyMapIterator extends AbstractEmptyMapIterator imple /** * Singleton instance of the iterator. + * * @since 3.1 */ @SuppressWarnings("rawtypes") @@ -37,6 +38,7 @@ public class EmptyMapIterator extends AbstractEmptyMapIterator imple /** * Gets a typed instance of the iterator. + * * @param the key type * @param the value type * @return {@link MapIterator}<K, V> diff --git a/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedIterator.java index ea5c805f4d..8edda19b2e 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedMapIterator.java index 6c3ba3f4df..b3e0fb4de7 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EmptyOrderedMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -30,6 +30,7 @@ public class EmptyOrderedMapIterator extends AbstractEmptyMapIterator extends AbstractEmptyMapIterator the key type * @param the value type * @return {@link OrderedMapIterator}<K, V> diff --git a/src/main/java/org/apache/commons/collections4/iterators/EntrySetMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EntrySetMapIterator.java index 2e8561cdac..1c7aaf3264 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EntrySetMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EntrySetMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/EnumerationIterator.java b/src/main/java/org/apache/commons/collections4/iterators/EnumerationIterator.java index 7bc1f51fa0..9a83e7ebfc 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/EnumerationIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/EnumerationIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -31,12 +31,13 @@ public class EnumerationIterator implements Iterator { /** The collection to remove elements from */ private final Collection collection; + /** The enumeration being converted */ private Enumeration enumeration; + /** The last object retrieved */ private E last; - // Constructors /** * Constructs a new {@code EnumerationIterator} that will not * function until {@link #setEnumeration(Enumeration)} is called. @@ -77,7 +78,6 @@ public Enumeration getEnumeration() { return enumeration; } - // Iterator interface /** * Returns true if the underlying enumeration has more elements. * diff --git a/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java index d393b7b117..20a74b1628 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ExtendedIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -35,8 +35,8 @@ public final class ExtendedIterator implements IteratorOperations { /** - * Create an ExtendedIterator returning the elements of it. If it is itself an ExtendedIterator, return that; otherwise wrap - * it. + * Create an ExtendedIterator returning the elements of {@code it}. If {@code it} is itself an ExtendedIterator, return that; otherwise wrap + * {@code it}. * * @param The type of object returned from the iterator. * @param it The iterator to wrap. @@ -47,7 +47,7 @@ public static ExtendedIterator create(final Iterator it) { } /** - * Creates an ExtendedIterator wrapped round a {@link Stream}. The extended iterator does not permit .remove(). + * Creates an ExtendedIterator wrapped round a {@link Stream}. The extended iterator does not permit {@code .remove()}. *

    * The stream should not be used directly. The effect of doing so is undefined. *

    @@ -61,7 +61,7 @@ public static ExtendedIterator create(final Stream stream) { } /** - * Creates an ExtendedIterator wrapped round it, which does not permit .remove() even if it does. + * Creates an ExtendedIterator wrapped round {@code it}, which does not permit {@code .remove()} even if {@code it} does. * * @param The type of object returned from the iterator. * @param it The Iterator to wrap. @@ -93,7 +93,7 @@ public static ExtendedIterator flatten(final Iterator> iterat } /** - * Set to true if this wrapping doesn't permit the use of {@link #remove()}, otherwise removal is delegated to the base iterator. + * Set to {@code true} if this wrapping doesn't permit the use of {@link #remove()}, otherwise removal is delegated to the base iterator. */ private final boolean throwOnRemove; diff --git a/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java b/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java index 9fc280cd21..2fb4a9d94f 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java index 307537327d..67fb422c49 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -109,6 +109,7 @@ public FilterListIterator(final Predicate predicate) { /** * Not supported. + * * @param o the element to insert */ @Override @@ -194,6 +195,7 @@ public void remove() { /** * Not supported. + * * @param ignored the element with which to replace the last element returned by * {@code next} or {@code previous} */ diff --git a/src/main/java/org/apache/commons/collections4/iterators/IteratorChain.java b/src/main/java/org/apache/commons/collections4/iterators/IteratorChain.java index eb339097d1..031fb650c0 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/IteratorChain.java +++ b/src/main/java/org/apache/commons/collections4/iterators/IteratorChain.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -63,17 +63,22 @@ public class IteratorChain implements Iterator { private Iterator currentIterator; /** - * The "last used" Iterator is the Iterator upon which next() or hasNext() + * The "last used" Iterator is the Iterator upon which next() * was most recently called used for the remove() operation only */ private Iterator lastUsedIterator; /** - * ComparatorChain is "locked" after the first time compare(Object,Object) + * ComparatorChain is "locked" after the first time compare(Object, Object) * is called */ private boolean isLocked; + /** + * Contains the result of the last hasNext() call until next() is invoked + */ + private Boolean cachedHasNextValue; + /** * Constructs an IteratorChain with no Iterators. *

    @@ -163,7 +168,29 @@ public IteratorChain(final Iterator first, final Iterator iterator) { checkLocked(); - iteratorQueue.add(Objects.requireNonNull(iterator, "iterator")); + Objects.requireNonNull(iterator, "iterator"); + if (iterator instanceof UnmodifiableIterator) { + final Iterator underlyingIterator = ((UnmodifiableIterator) iterator).unwrap(); + if (underlyingIterator instanceof IteratorChain) { + // in case it is an IteratorChain, wrap every underlying iterators as unmodifiable + // multiple rechainings would otherwise lead to exponential growing number of function calls + // when the iteratorChain gets used. + for (final Iterator nestedIterator : ((IteratorChain) underlyingIterator).iteratorQueue) { + iteratorQueue.add(UnmodifiableIterator.unmodifiableIterator(nestedIterator)); + } + } else { + // we don't know anything about the underlying iterator, simply add it here + iteratorQueue.add(iterator); + } + } else if (iterator instanceof IteratorChain) { + // add the wrapped iterators directly instead of reusing the given instance + // multiple rechainings would otherwise lead to exponential growing number of function calls + // when the iteratorChain gets used. + iteratorQueue.addAll(((IteratorChain) iterator).iteratorQueue); + } else { + // arbitrary other iterator + iteratorQueue.add(iterator); + } } /** @@ -183,9 +210,10 @@ private void checkLocked() { @Override public boolean hasNext() { lockChain(); - updateCurrentIterator(); - lastUsedIterator = currentIterator; - return currentIterator.hasNext(); + if (cachedHasNextValue == null) { + updateCurrentIterator(); + } + return cachedHasNextValue; } /** @@ -219,9 +247,11 @@ private void lockChain() { @Override public E next() { lockChain(); - updateCurrentIterator(); + if (cachedHasNextValue == null) { + updateCurrentIterator(); + } lastUsedIterator = currentIterator; - + cachedHasNextValue = null; return currentIterator.next(); } @@ -241,10 +271,11 @@ public E next() { @Override public void remove() { lockChain(); - if (currentIterator == null) { - updateCurrentIterator(); + if (lastUsedIterator == null) { + throw new IllegalStateException("remove() has been invoked without next()"); } lastUsedIterator.remove(); + lastUsedIterator = null; // must never be used twice without next() being invoked } /** @@ -267,13 +298,16 @@ protected void updateCurrentIterator() { } else { currentIterator = iteratorQueue.remove(); } - // set last used iterator here, in case the user calls remove - // before calling hasNext() or next() (although they shouldn't) - lastUsedIterator = currentIterator; } - while (!currentIterator.hasNext() && !iteratorQueue.isEmpty()) { + while (true) { + cachedHasNextValue = currentIterator.hasNext(); + if (cachedHasNextValue) { + break; + } + if (iteratorQueue.isEmpty()) { + break; + } currentIterator = iteratorQueue.remove(); } } - } diff --git a/src/main/java/org/apache/commons/collections4/iterators/IteratorEnumeration.java b/src/main/java/org/apache/commons/collections4/iterators/IteratorEnumeration.java index c53c54b7e0..60a8d35568 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/IteratorEnumeration.java +++ b/src/main/java/org/apache/commons/collections4/iterators/IteratorEnumeration.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/IteratorIterable.java b/src/main/java/org/apache/commons/collections4/iterators/IteratorIterable.java index 20584d43a5..55127a0de7 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/IteratorIterable.java +++ b/src/main/java/org/apache/commons/collections4/iterators/IteratorIterable.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/IteratorOperations.java b/src/main/java/org/apache/commons/collections4/iterators/IteratorOperations.java index 54056e2cb4..1020a257ad 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/IteratorOperations.java +++ b/src/main/java/org/apache/commons/collections4/iterators/IteratorOperations.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/LazyIteratorChain.java b/src/main/java/org/apache/commons/collections4/iterators/LazyIteratorChain.java index 8ffab74ac2..958179f176 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/LazyIteratorChain.java +++ b/src/main/java/org/apache/commons/collections4/iterators/LazyIteratorChain.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java b/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java index 3c5ae62357..dbba4b722f 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ListIteratorWrapper.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -60,13 +60,16 @@ public class ListIteratorWrapper implements ResettableListIterator { /** The underlying iterator being decorated. */ private final Iterator iterator; + /** The list being used to cache the iterator. */ private final List list = new ArrayList<>(); /** The current index of this iterator. */ private int currentIndex; + /** The current index of the wrapped iterator. */ private int wrappedIteratorIndex; + /** Recall whether the wrapped iterator's "cursor" is in such a state as to allow remove() to be called */ private boolean removeState; diff --git a/src/main/java/org/apache/commons/collections4/iterators/LoopingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/LoopingIterator.java index 65bbe98e58..0bcdea5ee6 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/LoopingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/LoopingIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -42,6 +42,7 @@ public class LoopingIterator implements ResettableIterator { /** The collection to base the iterator on */ private final Collection collection; + /** The current iterator */ private Iterator iterator; diff --git a/src/main/java/org/apache/commons/collections4/iterators/LoopingListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/LoopingListIterator.java index c0defe371b..1f76ddf046 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/LoopingListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/LoopingListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -44,6 +44,7 @@ public class LoopingListIterator implements ResettableListIterator { /** The list to base the iterator on */ private final List list; + /** The current list iterator */ private ListIterator iterator; diff --git a/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java index 01f4c3d11b..916eeab927 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -37,6 +37,7 @@ public class NodeListIterator implements Iterator { /** The original NodeList instance */ private final NodeList nodeList; + /** The current iterator index */ private int index; diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java index c0178d0a94..2c0d82631f 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -38,10 +38,13 @@ public class ObjectArrayIterator implements ResettableIterator { /** The array */ final E[] array; + /** The start index to loop from */ final int startIndex; + /** The end index to loop to */ final int endIndex; + /** The current iterator index */ int index; diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java index 5c48204684..cc8bc4fc76 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectArrayListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java index 6ccadaf383..daae6e426a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -84,17 +84,22 @@ public class ObjectGraphIterator implements Iterator { /** The stack of iterators */ private final Deque> stack = new ArrayDeque<>(8); + /** The root object in the tree */ private E root; + /** The transformer to use */ private final Transformer transformer; /** Whether there is another element in the iteration */ private boolean hasNext; + /** The current iterator */ private Iterator currentIterator; + /** The current value */ private E currentValue; + /** The last used iterator, needed for remove() */ private Iterator lastUsedIterator; diff --git a/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java index 04e2e7acbe..e47d49a92e 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java b/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java index 0deaad290e..6aace66579 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -71,6 +71,7 @@ public class PermutationIterator implements Iterator> { /** * Standard constructor for this class. + * * @param collection the collection to generate permutations for * @throws NullPointerException if coll is null */ @@ -91,6 +92,7 @@ public PermutationIterator(final Collection collection) { /** * Indicates if there are more permutation available. + * * @return true if there are more permutations, otherwise false */ @Override @@ -100,6 +102,7 @@ public boolean hasNext() { /** * Returns the next permutation of the input collection. + * * @return a list of the permutator's elements representing a permutation * @throws NoSuchElementException if there are no more permutations */ diff --git a/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java b/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java index 340e793b28..d09f7d12d5 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/ReverseListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ReverseListIterator.java index 48b4dd6ff9..921c66f09a 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ReverseListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ReverseListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -42,8 +42,10 @@ public class ReverseListIterator implements ResettableListIterator { /** The list being wrapped. */ private final List list; + /** The list iterator being wrapped. */ private ListIterator iterator; + /** Flag to indicate if updating is possible at the moment. */ private boolean validForUpdate = true; diff --git a/src/main/java/org/apache/commons/collections4/iterators/SingletonIterator.java b/src/main/java/org/apache/commons/collections4/iterators/SingletonIterator.java index d660489ef8..49b4fb6872 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/SingletonIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/SingletonIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -32,10 +32,13 @@ public class SingletonIterator /** Whether remove is allowed */ private final boolean removeAllowed; + /** Is the cursor before the first element */ private boolean beforeFirst = true; + /** Has the element been removed */ private boolean removed; + /** The object */ private E object; diff --git a/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java index 871010909f..53529a98b2 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/SingletonListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -140,6 +140,7 @@ public int previousIndex() { /** * Remove the object from this iterator. + * * @throws IllegalStateException if the {@code next} or {@code previous} * method has not yet been called, or the {@code remove} method * has already been called after the last call to {@code next} diff --git a/src/main/java/org/apache/commons/collections4/iterators/SkippingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/SkippingIterator.java index 9f03fe49ce..26e4ff2246 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/SkippingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/SkippingIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/TransformIterator.java b/src/main/java/org/apache/commons/collections4/iterators/TransformIterator.java index 1b3d774aca..f7b4113fd7 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/TransformIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/TransformIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -31,6 +31,7 @@ public class TransformIterator implements Iterator { /** The iterator being used */ private Iterator iterator; + /** The transformer being used */ private Transformer transformer; diff --git a/src/main/java/org/apache/commons/collections4/iterators/UniqueFilterIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UniqueFilterIterator.java index 1d4b0a61d7..7370b1bd57 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UniqueFilterIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UniqueFilterIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -31,9 +31,9 @@ public class UniqueFilterIterator extends FilterIterator { /** - * Constructs a new {@code UniqueFilterIterator}. + * Constructs a new {@code UniqueFilterIterator}. * - * @param iterator the iterator to use + * @param iterator the iterator to use */ public UniqueFilterIterator(final Iterator iterator) { super(iterator, UniquePredicate.uniquePredicate()); diff --git a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableIterator.java index 836b3c1031..1fb56b5ccc 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -24,18 +24,20 @@ /** * Decorates an iterator such that it cannot be modified. *

    - * Attempts to modify it will result in an UnsupportedOperationException. + * Calling {@link #remove()} throws {@link UnsupportedOperationException}. *

    * * @param the type of elements returned by this iterator. + * @param The wrapped Iterator type. * @since 3.0 */ -public final class UnmodifiableIterator implements Iterator, Unmodifiable { +public final class UnmodifiableIterator> implements Iterator, Unmodifiable { /** * Decorates the specified iterator such that it cannot be modified. *

    * If the iterator is already unmodifiable it is returned directly. + *

    * * @param the element type * @param iterator the iterator to decorate @@ -49,18 +51,24 @@ public static Iterator unmodifiableIterator(final Iterator i final Iterator tmpIterator = (Iterator) iterator; return tmpIterator; } + return wrap(iterator); + } + + static > UnmodifiableIterator wrap(final T iterator) { return new UnmodifiableIterator<>(iterator); } - /** The iterator being decorated */ - private final Iterator iterator; + /** + * The decorated iterator. + */ + private final T iterator; /** * Constructs a new instance. * - * @param iterator the iterator to decorate + * @param iterator the iterator to decorate. */ - private UnmodifiableIterator(final Iterator iterator) { + private UnmodifiableIterator(final T iterator) { this.iterator = iterator; } @@ -74,9 +82,13 @@ public E next() { return iterator.next(); } + // TODO This method can be removed in 5.0 since it's implemented as a default method in Iterator. @Override public void remove() { - throw new UnsupportedOperationException("remove() is not supported"); + throw new UnsupportedOperationException("remove"); } + T unwrap() { + return iterator; + } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java index ee4689d9a6..ff81b3e403 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableMapIterator.java index 26314208e8..24e7468d56 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIterator.java b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIterator.java index a2a0305157..f34437b59d 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/ZippingIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ZippingIterator.java index 52b8bae0db..7634cf3956 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ZippingIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ZippingIterator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/iterators/package-info.java b/src/main/java/org/apache/commons/collections4/iterators/package-info.java index dbf080e83a..4fe80902db 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/package-info.java +++ b/src/main/java/org/apache/commons/collections4/iterators/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java index 3c13e71d0d..4a602681a4 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -30,6 +30,7 @@ public abstract class AbstractKeyValue implements KeyValue { /** The key */ private K key; + /** The value */ private V value; diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java index 9ace5dd569..af34ddd5b8 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryDecorator.java b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryDecorator.java index 08bd0d24ed..6cef4c562c 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryDecorator.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/DefaultKeyValue.java b/src/main/java/org/apache/commons/collections4/keyvalue/DefaultKeyValue.java index fcbf02f1f0..78c75c3dd1 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/DefaultKeyValue.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/DefaultKeyValue.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/DefaultMapEntry.java b/src/main/java/org/apache/commons/collections4/keyvalue/DefaultMapEntry.java index 19b99ea170..3b13a25188 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/DefaultMapEntry.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/DefaultMapEntry.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/MultiKey.java b/src/main/java/org/apache/commons/collections4/keyvalue/MultiKey.java index 9e4f451d88..dcc621eb3b 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/MultiKey.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/MultiKey.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -233,6 +233,7 @@ public MultiKey(final K[] keys, final boolean makeClone) { /** * Calculate the hash code of the instance using the provided keys. + * * @param keys the keys to calculate the hash code for */ private void calculateHashCode(final Object[] keys) { @@ -316,6 +317,7 @@ public int hashCode() { * Recalculate the hash code after deserialization. The hash code of some * keys might have change (hash codes based on the system hash code are * only stable for the same process). + * * @return the instance with recalculated hash code */ protected Object readResolve() { diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/TiedMapEntry.java b/src/main/java/org/apache/commons/collections4/keyvalue/TiedMapEntry.java index 92295bbe1a..47c9298a7e 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/TiedMapEntry.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/TiedMapEntry.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntry.java b/src/main/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntry.java index a966420227..c0d8c65e91 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntry.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntry.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/package-info.java b/src/main/java/org/apache/commons/collections4/keyvalue/package-info.java index 1f4b64c633..4a1b204464 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/package-info.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -20,10 +20,11 @@ * These are usually used in maps, however they can be used as data holders in any collection. *

    * The following key/value designs are included: + *

    *
      - *
    • Map Entry - various map entry implementations - *
    • KeyValue - a key and value pair, without map entry semantics - *
    • MultiKey - a holder of multiple keys tied together + *
    • Map Entry - various map entry implementations
    • + *
    • KeyValue - a key and value pair, without map entry semantics
    • + *
    • MultiKey - a holder of multiple keys tied together
    • *
    */ package org.apache.commons.collections4.keyvalue; diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java index a2f6aeef93..fe9e30ea2f 100644 --- a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java +++ b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -43,7 +43,7 @@ * * @param the type of elements in this list * @since 3.0 - * @deprecated use {@link AbstractLinkedListJava21} instead + * @deprecated Use {@link AbstractLinkedListJava21} instead */ @Deprecated public abstract class AbstractLinkedList implements List { @@ -438,8 +438,10 @@ protected static class Node { /** A pointer to the node before this node */ protected Node previous; + /** A pointer to the node after this node */ protected Node next; + /** The object contained within this node */ protected E value; diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedListJava21.java b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedListJava21.java index d3a5855381..7a79d4dc3f 100644 --- a/src/main/java/org/apache/commons/collections4/list/AbstractLinkedListJava21.java +++ b/src/main/java/org/apache/commons/collections4/list/AbstractLinkedListJava21.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -229,12 +229,16 @@ public void set(final E obj) { * @param the type of elements in this list. */ protected static class LinkedSubList extends AbstractList { + /** The main list */ AbstractLinkedListJava21 parent; + /** Offset from the main list */ int offset; + /** Sublist size */ int size; + /** Sublist modCount */ int expectedModCount; @@ -437,8 +441,10 @@ protected static class Node { /** A pointer to the node before this node */ protected Node previous; + /** A pointer to the node after this node */ protected Node next; + /** The object contained within this node */ protected E value; diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractListDecorator.java b/src/main/java/org/apache/commons/collections4/list/AbstractListDecorator.java index 086f94f6cb..ee85167de5 100644 --- a/src/main/java/org/apache/commons/collections4/list/AbstractListDecorator.java +++ b/src/main/java/org/apache/commons/collections4/list/AbstractListDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -38,6 +38,7 @@ public abstract class AbstractListDecorator extends AbstractCollectionDecorat /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractListDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/list/AbstractSerializableListDecorator.java b/src/main/java/org/apache/commons/collections4/list/AbstractSerializableListDecorator.java index 7937e6c01c..bd9e0e9058 100644 --- a/src/main/java/org/apache/commons/collections4/list/AbstractSerializableListDecorator.java +++ b/src/main/java/org/apache/commons/collections4/list/AbstractSerializableListDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java b/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java index cbbd11c36e..c8e231b4c4 100644 --- a/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java +++ b/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -70,10 +70,13 @@ public class CursorableLinkedList extends AbstractLinkedList implements Se * @param the type of elements in this cursor. */ public static class Cursor extends AbstractLinkedList.LinkedListIterator { + /** Is the cursor valid (not closed) */ boolean valid = true; + /** Is the next index valid */ boolean nextIndexValid = true; + /** Flag to indicate if the current element was removed by another object. */ boolean currentRemovedByAnother; diff --git a/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java b/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java index f507f07202..bbfdafc38b 100644 --- a/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java +++ b/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/GrowthList.java b/src/main/java/org/apache/commons/collections4/list/GrowthList.java index 9880e75910..0376609279 100644 --- a/src/main/java/org/apache/commons/collections4/list/GrowthList.java +++ b/src/main/java/org/apache/commons/collections4/list/GrowthList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/LazyList.java b/src/main/java/org/apache/commons/collections4/list/LazyList.java index fe92de692c..1883bafa4d 100644 --- a/src/main/java/org/apache/commons/collections4/list/LazyList.java +++ b/src/main/java/org/apache/commons/collections4/list/LazyList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java b/src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java index 31411a4e24..89750f91ab 100644 --- a/src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java +++ b/src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/PredicatedList.java b/src/main/java/org/apache/commons/collections4/list/PredicatedList.java index f8c0f191a4..39d482178e 100644 --- a/src/main/java/org/apache/commons/collections4/list/PredicatedList.java +++ b/src/main/java/org/apache/commons/collections4/list/PredicatedList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/SetUniqueList.java b/src/main/java/org/apache/commons/collections4/list/SetUniqueList.java index aaec1e4ec5..30bba7f9ae 100644 --- a/src/main/java/org/apache/commons/collections4/list/SetUniqueList.java +++ b/src/main/java/org/apache/commons/collections4/list/SetUniqueList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/TransformedList.java b/src/main/java/org/apache/commons/collections4/list/TransformedList.java index eb701b264d..4a51aa1bdd 100644 --- a/src/main/java/org/apache/commons/collections4/list/TransformedList.java +++ b/src/main/java/org/apache/commons/collections4/list/TransformedList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/TreeList.java b/src/main/java/org/apache/commons/collections4/list/TreeList.java index 195018accb..57c15b24ef 100644 --- a/src/main/java/org/apache/commons/collections4/list/TreeList.java +++ b/src/main/java/org/apache/commons/collections4/list/TreeList.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -33,7 +33,7 @@ * A {@code List} implementation that is optimized for fast insertions and * removals at any index in the list. *

    - * This list implementation utilises a tree structure internally to ensure that + * This list implementation utilizes a tree structure internally to ensure that * all insertions and removals are O(log n). This provides much faster performance * than both an {@code ArrayList} and a {@code LinkedList} where elements * are inserted and removed repeatedly from anywhere in the list. @@ -76,23 +76,32 @@ public class TreeList extends AbstractList { * The nodes don't know the index of the object they are holding. They * do know however their position relative to their parent node. * This allows to calculate the index of a node while traversing the tree. + *

    *

    * The Faedelung calculation stores a flag for both the left and right child * to indicate if they are a child (false) or a link as in linked list (true). + *

    */ static class AVLNode { + /** The left child node or the predecessor if {@link #leftIsPrevious}.*/ private AVLNode left; + /** Flag indicating that left reference is not a subtree but the predecessor. */ private boolean leftIsPrevious; + /** The right child node or the successor if {@link #rightIsNext}. */ private AVLNode right; + /** Flag indicating that right reference is not a subtree but the successor. */ private boolean rightIsNext; + /** How many levels of left/right are below this one. */ private int height; + /** The relative position, root holds absolute position. */ private int relativePosition; + /** The stored element. */ private E value; @@ -132,6 +141,7 @@ private AVLNode(final int relativePosition, final E obj, * to this method will construct the subtree for elements {@code start} * through {@code end} of the collection, assuming the iterator * {@code e} already points at element {@code start}. + *

    * * @param iterator an iterator over the collection, which should already point * to the element at index {@code start} within the collection @@ -754,25 +764,31 @@ public String toString() { * A list iterator over the linked list. */ static class TreeListIterator implements ListIterator, OrderedIterator { + /** The parent list */ private final TreeList parent; + /** * Cache of the next node that will be returned by {@link #next()}. */ private AVLNode next; + /** * The index of the next node to be returned. */ private int nextIndex; + /** * Cache of the last node that was returned by {@link #next()} * or {@link #previous()}. */ private AVLNode current; + /** * The index of the last node that was returned. */ private int currentIndex; + /** * The modification count that the list is expected to have. If the list * doesn't have this count, then a @@ -788,6 +804,7 @@ static class TreeListIterator implements ListIterator, OrderedIterator * @param fromIndex the index to start at */ protected TreeListIterator(final TreeList parent, final int fromIndex) { + checkInterval(fromIndex, 0, parent.size(), parent.size()); this.parent = parent; this.expectedModCount = parent.modCount; this.next = parent.root == null ? null : parent.root.get(fromIndex); @@ -900,6 +917,21 @@ public void set(final E obj) { } } + /** + * Checks whether the index is valid. + * + * @param index the index to check. + * @param startIndex the first allowed index. + * @param endIndex the last allowed index. + * @param endIndex the size. + * @throws IndexOutOfBoundsException if the index is invalid + */ + private static void checkInterval(final int index, final int startIndex, final int endIndex, final int size) { + if (index < startIndex || index > endIndex) { + throw new IndexOutOfBoundsException("Invalid index:" + index + ", size=" + size); + } + } + /** The root node in the AVL tree */ private AVLNode root; @@ -949,6 +981,7 @@ public void add(final int index, final E obj) { *

    * This method runs in O(n + log m) time, where m is * the size of this list and n is the size of {@code c}. + *

    * * @param c the collection to be added to this list * @return {@code true} if this list changed as a result of the call @@ -977,9 +1010,7 @@ public boolean addAll(final Collection c) { * @throws IndexOutOfBoundsException if the index is invalid */ private void checkInterval(final int index, final int startIndex, final int endIndex) { - if (index < startIndex || index > endIndex) { - throw new IndexOutOfBoundsException("Invalid index:" + index + ", size=" + size()); - } + checkInterval(index, startIndex, endIndex, size()); } /** @@ -1055,14 +1086,13 @@ public ListIterator listIterator() { /** * Gets a ListIterator over the list. * - * @param fromIndex the index to start from - * @return the new iterator + * @param fromIndex the index to start from. + * @return the new iterator. */ @Override public ListIterator listIterator(final int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work - checkInterval(fromIndex, 0, size()); return new TreeListIterator<>(this, fromIndex); } diff --git a/src/main/java/org/apache/commons/collections4/list/UnmodifiableList.java b/src/main/java/org/apache/commons/collections4/list/UnmodifiableList.java index 9aadb13b72..322ff2df23 100644 --- a/src/main/java/org/apache/commons/collections4/list/UnmodifiableList.java +++ b/src/main/java/org/apache/commons/collections4/list/UnmodifiableList.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/list/package-info.java b/src/main/java/org/apache/commons/collections4/list/package-info.java index bb8d3e4d5c..15314592e3 100644 --- a/src/main/java/org/apache/commons/collections4/list/package-info.java +++ b/src/main/java/org/apache/commons/collections4/list/package-info.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java index d403e5d8f4..aee103d8b7 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -235,6 +235,7 @@ public String toString() { return new StringBuilder().append(getKey()).append('=').append(getValue()).toString(); } } + /** * Base Iterator. * diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java index 2ab0a0dff8..f78b84ec30 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractIterableMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractIterableMap.java index 67cabf6ed9..304b36fdff 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractIterableMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractIterableMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractLinkedMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractLinkedMap.java index e350f3e791..4f17657fba 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractLinkedMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractLinkedMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -140,8 +140,10 @@ public K previous() { * @param the value type. */ protected static class LinkEntry extends HashEntry { + /** The entry before this one in the order */ protected LinkEntry before; + /** The entry after this one in the order */ protected LinkEntry after; diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractMapDecorator.java b/src/main/java/org/apache/commons/collections4/map/AbstractMapDecorator.java index 42810d0da0..ffcae5ee29 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -47,6 +47,7 @@ public abstract class AbstractMapDecorator extends AbstractIterableMap extends AbstractMapDecor /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractOrderedMapDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java index 913f42a757..42f84c2942 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -94,6 +94,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap * Base iterator class. */ static class ReferenceBaseIterator { + /** The parent map */ final AbstractReferenceMap parent; @@ -197,6 +198,7 @@ public void remove() { * @since 3.1 */ protected static class ReferenceEntry extends HashEntry { + /** The parent map */ private final AbstractReferenceMap parent; @@ -309,6 +311,7 @@ protected void onPurge() { /** * Purges the specified reference + * * @param ref the reference to purge * @return true or false */ @@ -368,7 +371,7 @@ protected Object toReference(final ReferenceStrength type, final T referent, default: break; } - throw new Error(); + throw new IllegalArgumentException(type.toString()); } } @@ -517,6 +520,7 @@ public enum ReferenceStrength { /** * Resolve enum from int. + * * @param value the int value * @return ReferenceType * @throws IllegalArgumentException if the specified value is invalid. @@ -586,6 +590,7 @@ public V next() { * A soft reference holder. */ static class SoftRef extends SoftReference { + /** The hashCode of the key (even if the reference points to a value) */ private final int hash; @@ -619,6 +624,7 @@ public int hashCode() { * A weak reference holder. */ static class WeakRef extends WeakReference { + /** The hashCode of the key (even if the reference points to a value) */ private final int hash; diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractSortedMapDecorator.java b/src/main/java/org/apache/commons/collections4/map/AbstractSortedMapDecorator.java index f3f5169134..75a6d7dca3 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractSortedMapDecorator.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractSortedMapDecorator.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -59,6 +59,7 @@ protected static class SortedMapIterator extends EntrySetToMapIteratorAdap /** * Create a new AbstractSortedMapDecorator.SortedMapIterator. + * * @param entrySet the entrySet to iterate */ protected SortedMapIterator(final Set> entrySet) { @@ -94,6 +95,7 @@ public synchronized void reset() { /** * Constructor only used in deserialization, do not use otherwise. + * * @since 3.1 */ protected AbstractSortedMapDecorator() { diff --git a/src/main/java/org/apache/commons/collections4/map/CaseInsensitiveMap.java b/src/main/java/org/apache/commons/collections4/map/CaseInsensitiveMap.java index 579e00c871..4af21098a8 100644 --- a/src/main/java/org/apache/commons/collections4/map/CaseInsensitiveMap.java +++ b/src/main/java/org/apache/commons/collections4/map/CaseInsensitiveMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, diff --git a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java index 885d32042a..8161d6cb1f 100644 --- a/src/main/java/org/apache/commons/collections4/map/CompositeMap.java +++ b/src/main/java/org/apache/commons/collections4/map/CompositeMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -56,6 +56,7 @@ public class CompositeMap extends AbstractIterableMap implements Ser * @param the type of the values in the map */ public interface MapMutator extends Serializable { + /** * Called when the CompositeMap.put() method is invoked. * diff --git a/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java b/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java index f4c0821bfe..79e8e40f92 100644 --- a/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java +++ b/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java @@ -6,7 +6,7 @@ * (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 + * https://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, @@ -194,7 +194,7 @@ public ConcurrentReferenceHashMap get() { * Sets the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads. * * @param concurrencyLevel estimated number of concurrently updating threads - * @return this instance. + * @return {@code this} instance. */ public Builder setConcurrencyLevel(final int concurrencyLevel) { this.concurrencyLevel = concurrencyLevel; @@ -205,7 +205,7 @@ public Builder setConcurrencyLevel(final int concurrencyLevel) { * Sets the initial capacity. The implementation performs internal sizing to accommodate this many elements. * * @param initialCapacity the initial capacity. - * @return this instance. + * @return {@code this} instance. */ public Builder setInitialCapacity(final int initialCapacity) { this.initialCapacity = initialCapacity; @@ -216,7 +216,7 @@ public Builder setInitialCapacity(final int initialCapacity) { * Sets the reference type to use for keys. * * @param keyReferenceType the reference type to use for keys. - * @return this instance. + * @return {@code this} instance. */ public Builder setKeyReferenceType(final ReferenceType keyReferenceType) { this.keyReferenceType = keyReferenceType; @@ -227,7 +227,7 @@ public Builder setKeyReferenceType(final ReferenceType keyReferenceType) { * Sets the load factor factor, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold. * * @param loadFactor the load factor factor, used to control resizing - * @return this instance. + * @return {@code this} instance. */ public Builder setLoadFactor(final float loadFactor) { this.loadFactor = loadFactor; @@ -238,7 +238,7 @@ public Builder setLoadFactor(final float loadFactor) { * Sets the behavioral options. * * @param options the behavioral options. - * @return this instance. + * @return {@code this} instance. */ public Builder setOptions(final EnumSet