The API documentation for Android's SparseIntArray opens with:
SparseIntArrays map integers to integers.
I'm curious, then, why it doesn't implement Map<Integer, Integer>.
It seems to me that all that would've been required is a couple of different method names, a few trivial extra methods, and a bit of code to prohibit null
keys and values... certainly nothing that an EnumMap doesn't handle with grace. Am I overlooking something?
This isn't intended to be a swipe at the designers of the Android API. Normally when I wonder things like this, there turns out to be a good reason, and I learn something about the language or platform.