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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 9
    • core-libs
    • None

      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.

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

              Created:
              Updated:
              Resolved: