Menu

#30 CaseInsensitiveMap#containsKey() isn't case insensitive

open
nobody
None
5
2010-06-28
2010-06-28
No

The containsKey() method of the CaseInsensitiveMap isn't case insensitive. It seems that this method isn't overriden at all by collections-generic.
The following code snippet provides a good enough implementation with the correct behaviour:

@Override
public boolean containsKey(Object key) {
if (!(key instanceof String)){
return false;
}
return super.containsKey(this.convertKey((String)key));
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB