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

Guidance on stream limitations in laziness and termination

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None

      Description

      Streams generally produce elements lazily and avoid production of excess elements when there are short circuiting operations. However, for less common cases laziness is not possible There is a tradeoff between implementation complexity and laziness.

      Problematic cases arise for the following:
      1. use of an "escape hatch" iterator or spliterator terminal operation
      2. use of nested flatMap operations

      It would be beneficial to add some guidance to the stream package documentation.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: