Loading... (original) (raw)
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.