Skip to content

Commit

Permalink
8297299: SequenceInputStream should not use Vector
Browse files Browse the repository at this point in the history
Reviewed-by: alanb, jpai
  • Loading branch information
mkarg authored and jaikiran committed Nov 22, 2022
1 parent f0e99c6 commit 0696854
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/java.base/share/classes/java/io/SequenceInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@

package java.io;

import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Objects;
import java.util.Vector;

/**
* A {@code SequenceInputStream} represents
Expand All @@ -39,12 +40,12 @@
* and so on, until end of file is reached
* on the last of the contained input streams.
*
* @author Author van Hoff
* @author Arthur van Hoff
* @since 1.0
*/
public class SequenceInputStream extends InputStream {
Enumeration<? extends InputStream> e;
InputStream in;
private final Enumeration<? extends InputStream> e;
private InputStream in;

/**
* Initializes a newly created {@code SequenceInputStream}
Expand Down Expand Up @@ -79,11 +80,7 @@ public SequenceInputStream(Enumeration<? extends InputStream> e) {
* @param s2 the second input stream to read.
*/
public SequenceInputStream(InputStream s1, InputStream s2) {
Vector<InputStream> v = new Vector<>(2);
v.addElement(s1);
v.addElement(s2);
e = v.elements();
peekNextStream();
this(Collections.enumeration(Arrays.asList(s1, s2)));
}

/**
Expand Down

1 comment on commit 0696854

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.