src/share/classes/java/util/TreeMap.java

Print this page
rev 3503 : [mq]: cr5045147

@@ -526,15 +526,12 @@
      *         does not permit null keys
      */
     public V put(K key, V value) {
         Entry<K,V> t = root;
         if (t == null) {
-            // TBD:
-            // 5045147: (coll) Adding null to an empty TreeSet should
-            // throw NullPointerException
-            //
-            // compare(key, key); // type check
+            compare(key, key); // type (and possibly null) check
+
             root = new Entry<>(key, value, null);
             size = 1;
             modCount++;
             return null;
         }