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

add variation of Stream.iterate() that's finite

    XMLWordPrintable

Details

    Description

      Stream.iterate() and Stream.generate() are factories for infinite streams. It would be nice if there were a similar stream factory methods that could return finite streams.

      We are also considering something like Stream.takeWhile() -- see JDK-8071597 -- but this will terminate a stream based on a predicate on the stream value itself, not on some changed state of the stream source (e.g., reaching EOF).

      Attachments

        Issue Links

          Activity

            People

              tvaleev Tagir Valeev
              smarks Stuart Marks
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: