RFR: JDK-8297299 SequenceInputStream should not use Vector [v2]

Markus KARG duke at openjdk.org
Sun Nov 20 09:18:18 UTC 2022


On Sun, 20 Nov 2022 09:07:21 GMT, Markus KARG <duke at openjdk.org> wrote:

>> There is no need to use a temporary Vector within the constructor of SynchronizedInputStream, as more efficient (non-synchronized) alternative code (like List.of) will do the same in possibly less time. While the optimization is not dramatic, it still makes sense to replace Vector unless synchronization is really needed.
>
> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
> 
>   allowing s2 to be null

src/java.base/share/classes/java/io/SequenceInputStream.java line 82:

> 80:      * @param   s2   the second input stream to read.
> 81:      */
> 82:     public SequenceInputStream(InputStream s1, InputStream s2) {

BTW, what is your opinion @jaikiran  and @AlanBateman: We could simplify the 2-arg constructor by calling `this(...)` instead of repeating the 1-arg constructor's implementation here. Is that a *preferred* or a *disliked* pattern in OpenJDK?

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

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


More information about the core-libs-dev mailing list