On Thu, 24 Dec 2020 17:30:41 GMT, Xue-Lei Andrew Fan <[email protected]> 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.

There's one more issue about it: `List.of()` throws NPE when argument is `null` 
while `Collections.singletonList()` returns a list with `null` inside.

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

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

Reply via email to