Arrays.stream should accept null

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • None
    • Affects Version/s: 8
    • Component/s: 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)

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

              Created:
              Updated:
              Resolved: