Nikhil,

Do you have a test case to prove this behaviour? What would like to see as a solution - an update to the JavaDoc to explicitly indicate that inserting a key with null value(s) into a MultiMap returns false, or a code change?

Steve.

---
Stephen Smith, MEng (Wales).
http://www.stephen-smith.co.uk/

Nikhil G. Daddikar (JIRA) wrote:
containsKey on MultiHashMap seems incorrect
-------------------------------------------

                 Key: COLLECTIONS-250
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-250
             Project: Commons Collections
          Issue Type: Bug
          Components: Map
    Affects Versions: 3.2, 3.1
            Reporter: Nikhil G. Daddikar
            Priority: Critical



MultiHashMap m = new MultiHashMap();
m.putAll("key", Collections.EMPTY_LIST);
System.out.println(m.containsKey("key")) It says false, when it should have printed true.
The problem is that the code in MultiHashMap and even MultiValueMap has in 
putAll():

if (values == null || values.size() == 0) {
            return false;
}

This means that they key is never being entered into the Map. This is causing a 
huge problem because the behaviour has changed.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to