title: How null element is treated by list and map in Java
body: <p>What can be rational for below output ?
  null elements are treated differently by list and map.</p>
  
  <pre><code>List&lt;Object&gt; hoo = new ArrayList&lt;Object&gt;() {
      {
          add(null);
          add(null);
      }
  };
  
  Map&lt;Object, Object&gt; bar = new HashMap&lt;Object, Object&gt;() {
      {
          put(null, null);
          put(null, null);
          put(null, null);
  
      }
  };
  System.err.println("hoo:" + hoo.size());
  System.err.println("bar:" + bar.size());
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>hoo:2
  bar:1
  </code></pre>