Reputation:
I have one parent HashMap
like
Hashmap<String, Hashmap<String,Arraylist<Customclass>>>
Now itertaing over first hashmap that is parent hashmap gives me values like
key1-------[key of subHashmap(value)] key2-------[key of subHashmap(value)] . . . Now I want to iterate over hashmap that is in values of parent hashmap based on their keys.
How I would be able to achieve this. .
Upvotes: 0
Views: 49
Reputation: 3663
This should do:
for (Map.Entry<String, HashMap<String, ArrayList<CustomClass>> entry : outerHashMap.entrySet()) {
String entryKey= entry.getKey();
// ...
for (Map.Entry<String, ArrayList<CustomClass> nestedentry : entry.getValue().entrySet()) {
String name = nestedEntry.getKey();
ArrayList<CustomClass> value = nestedEntry.getValue();
// ...
}
}
Upvotes: 2