This might be a silly question, but I have never found a satisfying way to name a variable of type HashMap
in Java. For example - lets say I have a
My opinion would be to have it countiesCountOfStateMap
or simply countiesOfStateMap
since we will be getting the counties count using the State.
It would be more meaningful to have it like this, so when new person looks into your code atleast he would be aware of what is contained in it.
But at the end of the day its your decision to have the appropriate name and as @tulskiy mentioned naming the class and variable appropriately is one of the harder things.
I would call it numCounties
or countyCounts
.
Whatever explains it best - In this case stateToCountyMap
is ok or else countiesInStateMap
can be used.