java util map,我应该如何命名java.util.Map?
I have a java.util.Map that maps from a logical name to a set of parameters to use with that name.
Map howShouldINameThee = ...;
What is the best name for this map?
Should I go simple and just call this parameters or parametersMap?
Do I include information about the key in the name like paramtersByName so that how to use the String key is more obvious?
解决方案
A Map maps something to something else.
I like to use names like uidToPerson. "To" being the shortest unambiguous way I can think of to show that I have a map.
Edit:
I'll add that I prefer to have the map named this way, because "key" and "value" appear in that order in the name. As opposed to valueByKey. In mapping operations, the key comes first. You put(key, value) or get(key) that gives a value.
Of course this is a matter of personal preference.
创作挑战赛新人创作奖励来咯,坚持创作打卡瓜分现金大奖总结
以上是生活随笔为你收集整理的java util map,我应该如何命名java.util.Map?的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 看片不怕没字幕!小爱同学AI字幕上新:日
- 下一篇: java如何用键盘输入_java中如何从