Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8072726

add adapter to convert Enumeration to Iterator

    Details

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  smarks Stuart Marks
                  Reporter:
                  smarks Stuart Marks
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: