I’ve always struggled somewhat with finding the right name for map-like variables. Naming things is hard, but surely it’s redundant to name your map
thingMap (as in
Map<Thing> thingMap = new ...), especially in languages that are strongly-typed.
I try to name my maps
XToY, where X is key and Y is value, and the Internet seems to agree, but this doesn’t make much sense either if my keys and values are expressive types. In other words, if I have
Map<SocialSecurityNumber, Name>, then it doesn’t help much to name the variable
But if I just have a
Map<String, Integer> then a variable named
nameToCount is useful.