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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 11
    • 9
    • core-libs
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: