On Fri, 27 May 2022 16:08:03 GMT, liach <d...@openjdk.java.net> wrote:

> If `parameterList` is too slow for `List.of` copies the backing parameter 
> types array, wouldn't calling 
> `JavaUtilCollectionAccess::listFromTrustedArray` a better alternative, as it 
> only allocates one wrapper and has better performance on `subList` than 
> `Arrays.copyOfRange`?

No, because `listFromTrustedArray` doesn’t allow invocation with array classes 
other than `Object[].class`:
https://github.com/openjdk/jdk/blob/6520843f86f638fe4d1e5b3358fab5799daca654/src/java.base/share/classes/java/util/ImmutableCollections.java#L195-L222

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

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

Reply via email to