Posts tagged case sensitivity
Here’s the bug that had me working today (a Sukot holiday):
_myMap.get(key) // without lower casing the key.
At first you might think of this as a common human error, but I claim that it’s no less of a code smell:
Why trust yourself to always remember to lower/upper case all of the interactions with the map? What about trusting others?
So, instead of using a HashMap, use an Apache CaseInsensitiveMap that nicely and safely encapsulates this key’s case concern.
I would expect CaseInsensitiveMap to become a part of the Java SDK.