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

Document NPE on immutable collections query methods

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      When creating collecctions with the static factoy methods List.of(), Set.of() and Map.of(), the resulting collections will throw NullPointerExceptions when a query method is invoked with a null parameter. For example contains(null), indexOf(null), containsKey(null), containsAll(Arrays.asList(null))

      This behavior is extremely unobvious and should be documented.

      See also:
      https://bugs.openjdk.java.net/browse/JDK-8265905
      https://github.com/jdbi/jdbi/issues/1263
      https://www.reddit.com/r/java/comments/ni42ot/listof_is_terrible/



            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: