[11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

Stuart Marks stuart.marks at oracle.com
Mon Mar 26 18:45:29 UTC 2018


On 3/22/18 11:50 PM, Zheka Kozlov wrote:
> I noticed that List.copyOf() allocates an array twice. The first allocation is 
> coll.toArray(), the second one is in ListN constructor. Can we do something with it?

Yeah, I still need to fix that. The various fixed-args List.of() factory methods 
also do extra copies, as do the stream Collectors.toUnmodifiableX(). This is all 
covered by JDK-8156071.

https://bugs.openjdk.java.net/browse/JDK-8156071

s'marks


More information about the core-libs-dev mailing list