RFR: 6323374: (coll) Optimize Collections.unmodifiable* and synchronized* [v6]

Ian Graves igraves at openjdk.java.net
Thu Mar 4 03:45:14 UTC 2021


> Modify the `unmodifiable*` methods in `java.util.Collections` to be idempotent. That is, when given an immutable collection from `java.util.ImmutableCollections` or `java.util.Collections`, these methods will return the reference instead of creating a new immutable collection that wraps the existing one.

Ian Graves has updated the pull request incrementally with one additional commit since the last revision:

  Avoid wrapping subclasses where relevant. Updated tests.

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2596/files
  - new: https://git.openjdk.java.net/jdk/pull/2596/files/8109e158..dda174c5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2596&range=05
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2596&range=04-05

  Stats: 46 lines in 2 files changed: 42 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2596.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2596/head:pull/2596

PR: https://git.openjdk.java.net/jdk/pull/2596


More information about the core-libs-dev mailing list