On Fri, 27 Jan 2023 13:53:45 GMT, Glavo <d...@openjdk.org> wrote:

>> I checked the `java.base` module, and all the `Collection#toArray()` method 
>> of collections be implemented correctly.
>> 
>> Their return values can be trusted, so many unnecessary array duplication 
>> can be eliminated.
>
> Glavo has updated the pull request incrementally with one additional commit 
> since the last revision:
> 
>   Collections.isTrustedCollection

I think the simplest solution is to have a non public interface declared inside 
java.util. Like java.util.RandomAccess, but non public.
The main advantage to use an interface is that you can document it and it's 
easy to find all the implementations.

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

PR: https://git.openjdk.org/jdk/pull/12212

Reply via email to