通过添加/减去相应值来合并地图
几天来我一直在想,什么是解决我的问题最不混乱的方法。我有一组 10 个枚举类型,例如 { 零、一、二、三、四、五、六、七、八、九},我使用这些枚举作为映射中的键
Map<MyEnumType, Integer> myMap;
然后生成 100 个左右的这些映射,具有相同的键但不同的值。将所有这些地图添加到一张地图中的最佳做法是什么?我的意思是把我生成的 100 张地图的所有价值加起来。
I have been wondering for a few days now, what could be the least messy approach to my problem. I have a set of 10 enum types e.g. { ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE } and I use these enums as keys in a map
Map<MyEnumType, Integer> myMap;
Then I generate 100 or so of these maps, with the same keys but different values. What is the best practice for adding all of these maps into one? I mean adding up all the value of those 100 maps I have generated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
