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

Arrays.stream should accept null

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 8
    • core-libs
    • None

      Passing a null array to Arrays.stream results in a NPE, although it is not specified what the behaviour should be so potentially could be modified.

      For more null-friendly behaviour, especially when used with flatMap, a null array could map to an empty stream.

      Such behaviour would also propagate up to Stream.of, the current implementation of which defers to Arrays.stream, thus no new method such as Stream.ofNullable would be required (as proposed by JDK-8050819)

            psandoz Paul Sandoz
            psandoz Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: