How to name a HashMap in Java?

后端 未结 9 1915
难免孤独
难免孤独 2021-02-01 00:55

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

9条回答
  •  眼角桃花
    2021-02-01 01:21

    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.

提交回复
热议问题