Affects Version/s: 2.1.*
Fix Version/s: 2.1.*
Since MultiMap is used in many places we are going to continue to support it. So I started to unit test it. And in doing so, I found inconsistent behaviors for the API.
The biggest problem is with the definition of the behavior when given an empty list. Consider this:
MultiMap<String, String> mm = new MultiMap<String, String>();
int size = mm.size(); // Will return zero
mm.set(KEY1, new LinkedList<String>());
size = mm.size(); // Will return 1
boolean containsKey = mm.containsKey(KEY1); // Returns false!
The real question at this point is which is correct, the "containsKey" or the "size" ?
This same problem occurs in other manners, for example if you remove every value in a key the "containsKey" for that key will return false but the "size" method will still account for the key with the empty list.