We have a situation where we are ending up using multi-level hash maps; that is, a hash map inside of a hash map, three or four levels deep.
Instinctively this felt wrong somewhere. I have read posts here that talks about how to iterate/use a multi-level hash map, but hardly any of them say what is the best practice for this.
Why are multi level hash maps bad, and what would be the better design, if any?
Here is the sample design of multi-level hash maps that we have:
Map map1;
class Object1 {
String version;
Map map2;
}
class Object2 {
Map> map4;
Map map5;
}
解决方案
As long as they're properly abstracted, it's not that big of a deal, but you lead yourself down some nasty rabbit holes in terms of readability. Without abstraction, maintaining this becomes a ni