RFR: 8302603: Use Set.of in java.nio.charset.Charset [v3]

Glavo duke at openjdk.org
Mon Feb 20 18:34:52 UTC 2023


> A small patch, using `Set.of` instead of `Collections.unmodifiableSet()` of `Charset#aliasSet`.
> 
> The alias should not be null, and the aliasSet is an immutable copy, so it is safe to use `Set.of`.
> 
> I have investigated all charsets, most of charsets have no more than 4 aliases, and the maximum is only 17.
> 
> In this case, the performance difference between immutable sets and HashSet can be ignored, and the memory footprint of immutable sets is smaller.
> 
> I need someone to help me open an Issue on JBS. Thank you very much.

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

  update

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12570/files
  - new: https://git.openjdk.org/jdk/pull/12570/files/0eea8b8c..fdb423d4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12570&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12570&range=01-02

  Stats: 5 lines in 1 file changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/12570.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12570/head:pull/12570

PR: https://git.openjdk.org/jdk/pull/12570


More information about the nio-dev mailing list