What can be rational for below output ? null elements are treated differently by list and map.
List<Object> hoo = new ArrayList<Object>() {
{
add(null);
add(null);
}
};
Map<Object, Object> bar = new HashMap<Object, Object>() {
{
put(null, null);
put(null, null);
put(null, null);
}
};
System.err.println("hoo:" + hoo.size());
System.err.println("bar:" + bar.size());
Output:
hoo:2
bar:1