RFR: 8258852: Arrays.asList() for single item could be replaced with Collections.singletonList()

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Thu Dec 24 17:33:56 UTC 2020


On Thu, 24 Dec 2020 15:00:04 GMT, Sean Mullan <mullan at openjdk.org> wrote:

> What about using List.of() instead?

For now, the Collections.singletonList() is more compact, which uses one class variable.  While List.of(T) shares the internal implementation with List.of(T t1, T t2), which uses two class variables.

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

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



More information about the security-dev mailing list