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字幕上新:日
- 下一篇: 《风起洛阳》和《谁是凶手》致豆瓣口碑暴跌