title: Map.keySet() and Set.addAll throwing NullPoniterException
body: <p>It is a old code and am debugging it. 
  I have a <code>Map</code> (myMap) with size 2 (for sure). Keys are <code>null</code> and <code>1</code>.</p>
  
  <pre><code>SortedSet mySet = new TreeSet();
  mySet.addAll(myMap.keySet());
  Iterator mySetIterator = mySet.iterator();
  while (mySetIterator.hasNext()) {
       Object newObj = mySetIterator.next();
       Object mapObj = myMap.get(newObj);
  }
  </code></pre>
  
  <p>This <code>while</code> loop, iterates for only one time. I am not sure what is wrong here. Is there any problem?</p>
  
  <p>Please help me. Thanks in advance.</p>
  
  <p>Update:</p>
  
  <p>Now I am getting below exception in <code>mySet.addAll(myMap.keySet());</code></p>
  
  <pre><code>&lt;Oct 18, 2011 12:36:21 PM IST&gt; &lt;Error&gt; &lt;&gt; &lt;BEA-000000&gt; &lt;java.lang.NullPointerException
      at edu.emory.mathcs.backport.java.util.TreeMap.compare(TreeMap.java:934)
      at edu.emory.mathcs.backport.java.util.TreeMap.put(TreeMap.java:97)
      at edu.emory.mathcs.backport.java.util.TreeSet.add(TreeSet.java:149)
      at java.util.AbstractCollection.addAll(AbstractCollection.java:318)
      at edu.emory.mathcs.backport.java.util.TreeSet.addAll(TreeSet.java:165)
  </code></pre>