-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b68
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8098738 | emb-9 | Stuart Marks | P4 | Resolved | Fixed | team |
This is primarily to support legacy code which might still provide only Enumerations.
One can easily write one's own Iterator class that wraps an enumeration, but the library should provide this.
An alternative is
Collections.list(enumeration).iterator()
but this copies out and stores all elements of the enumeration before returning the iterator.
Once the Enumeration is converted to an Iterator, it can then be converted to a Stream by using
StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, ...), ...);
We will not support any means to convert Iterators or Streams to Enumeration, since Enumeration is a legacy API.
One can easily write one's own Iterator class that wraps an enumeration, but the library should provide this.
An alternative is
Collections.list(enumeration).iterator()
but this copies out and stores all elements of the enumeration before returning the iterator.
Once the Enumeration is converted to an Iterator, it can then be converted to a Stream by using
StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, ...), ...);
We will not support any means to convert Iterators or Streams to Enumeration, since Enumeration is a legacy API.
- backported by
-
JDK-8098738 add adapter to convert Enumeration to Iterator
-
- Resolved
-
- blocks
-
JDK-8081678 Add Stream returning methods to classes where there currently exist only Enumeration returning methods
-
- Closed
-
- relates to
-
JDK-6389004 (coll) Collections.list should take Iterator, not just Enumeration
-
- Closed
-
-
JDK-6966608 public static <T> Iterable<T> Collections.iterable(Enumeration<T>)
-
- Closed
-