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

List.of().indexOf(null) doesn't throw NullPointerException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None

      Description

      Lists produced by the various List.of() factories does not accept null elements or parameters. For consistency one would expect the same from indexOf.

      Overridden implementations can profitably be implemented to avoid going through AbstractList.indexOf, which allocates iterators to implement the behavior.

      Same issue applies to the lastIndexOf method.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: