RFR: 8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp
Markus KARG
duke at openjdk.java.net
Sun Nov 14 14:47:37 UTC 2021
On Sun, 14 Nov 2021 14:43:00 GMT, Markus KARG <duke at openjdk.java.net> wrote:
>> test/jdk/java/nio/channels/Channels/TransferTo.java line 78:
>>
>>> 76:
>>> 77: private static Collection<Path> tempFiles;
>>> 78:
>>
>> Is there a reason you chose a LinkedList over a List here? As mentioned below, you could initialize tempFiles here.
>>
>> Please change Collection -> LinkedList or if you use a List initialize with an ArrayList()
>
> If you change from an interface to a particular implementation you give the reader the impression that the code will only work with this particular implementation, and you give the impression that the code will only work in a particular sequence when using List or LinkedList, which both is not true. The Collection interface was chosen deliberately to clearly tell the reader that both is completely irrelevant and may be changed at any time if needed. If I do what you want, others will fear to break something. So i would like to stay with the code as-is.
What *actual* benefit will you reach in this *particular* source code by using array list instead of linked list?
-------------
PR: https://git.openjdk.java.net/jdk/pull/6379
More information about the nio-dev
mailing list