On Mon, 19 Dec 2022 11:26:25 GMT, Romain Manni-Bucau <d...@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) I guess it can be counted as micro-optimization, seeing that `Collections.enumeration` actually wraps the underlying `Iterator` into `Enumeration`, and this allows to use that `Iterator` directly in case of two-stream concatenation. The majority of JDK uses cases are 2-stream concats. Minor nits: src/java.base/share/classes/java/io/SequenceInputStream.java line 47: > 45: */ > 46: public class SequenceInputStream extends InputStream { > 47: private final Iterator<? extends InputStream> e; Should be `iter` now, not `e`? ------------- PR Review: https://git.openjdk.org/jdk/pull/11718#pullrequestreview-1543054058 PR Review Comment: https://git.openjdk.org/jdk/pull/11718#discussion_r1271984209