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

SequencedMap::firstEntry throws NPE when first entry has null key or value

XMLWordPrintable

      Observed that SequencedMap:firstEntry() throws NullPointerEx when the map entry has null key or null value.

      Example : the following code snippet throws NPEx.
      ======== ( When key is null )
      SequencedMap<String, String> sequencedMap = new LinkedHashMap<>();
              sequencedMap.put(null, "v1");
              sequencedMap.firstEntry();

      ======== (When value is null )
      SequencedMap<String, String> sequencedMap = new LinkedHashMap<>();
              sequencedMap.put("k", null);
              sequencedMap.firstEntry();

      =====

            smarks Stuart Marks
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: