RFR: 8305947: SequenceInputStream implementation can use an Iterator rather than Enumeration
Romain Manni-Bucau
duke at openjdk.org
Fri Jun 9 07:27:09 UTC 2023
On Tue, 11 Apr 2023 07:48:45 GMT, Jens Lidestrom <duke at openjdk.org> wrote:
>> enumeration(list) will create an enumeration, a list and an iterator whereas the impl only requires an iterator
>> this PR drops the enumeration wrapper for binary constructor and just maps the enumeration to an iterator for the other case which should be a better compromise in practise.
>>
>> Another side but nice effect is to have some lighter classloading (subgraph)
>
> src/java.base/share/classes/java/io/SequenceInputStream.java line 82:
>
>> 80: */
>> 81: public SequenceInputStream(InputStream s1, InputStream s2) {
>> 82: this(List.of(s1, s2).iterator());
>
> This changes the behaviour for null streams. This line will throw NPE. The previous code throwed NPE in `peekNextStream`, only if the stream was used.
>
> Have your make sure that it is okay to change behaviour?
good catch, switching back to Arrays.asList then.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/11718#discussion_r1162434746
More information about the core-libs-dev
mailing list