I checked the `java.base` module, and all the `Collection#toArray()` method of collections be implemented correctly.
Their return values can be trusted, so many unnecessary array duplication can be eliminated. ------------- Commit messages: - fix checkstyle - Update ImmutableCollections - Merge branch 'master' into array-copy - Rollback Collectors - fix checkstyle - update - Update List.copyOf - Return value of toArray of collection types in java.base should be trusted Changes: https://git.openjdk.org/jdk/pull/12212/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12212&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8301220 Stats: 14 lines in 6 files changed: 2 ins; 2 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/12212.diff Fetch: git fetch https://git.openjdk.org/jdk pull/12212/head:pull/12212 PR: https://git.openjdk.org/jdk/pull/12212