RFR: 8258852: Arrays.asList() for single item could be replaced with List.of() [v2]

Sean Mullan mullan at openjdk.java.net
Tue Jan 5 18:03:55 UTC 2021

On Sat, 2 Jan 2021 18:52:08 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> If there is only one item, the call to Arrays.asList() could be replaced with List.of() for less memory occupation.  This update also includes some other code cleanup, like redundant variables in the related files.
>> Code cleanup only, no new regression test.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8258852
> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
>   Replace Collections.singletonList() with List.of()

Marked as reviewed by mullan (Reviewer).

src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java line 142:

> 140:         this.identificationProtocol = null;
> 141:         this.serverNames = Collections.emptyList();
> 142:         this.sniMatchers = Collections.emptyList();

Here you use Collections.emptyList() instead of List.of(). Probably ok, but maybe you want to change that to List.of().


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

More information about the security-dev mailing list