Hi, habe hier eine zweistufige Map, wie kann man die innere Map gezielt nach einem Wertepaar fragen wenn man den Schlüssel hat?
greets
metalfan
Code:
Map<String, Map<String, String>> test = new HashMap<String, Map<String, String>>();
Map<String, String> test1 = new HashMap<String, String>();
test1.put("Captain", "Sparrow");
test1.put("barbossa", "2ndCaptain");
Map<String, String> test2 = new HashMap<String, String>();
test2.put("lala", "bus");
test2.put("bla", "auto");
test.put("map1", test1);
test.put("map2", test2);
for (Map.Entry<String, Map<String, String>> e: test.entrySet()){
System.out.println(e);
if (e.getKey()=="map1"){
//hier auf die innere map zugreifen ohne alle elemente abzulaufen?
System.out.println(e.getValue());
}
greets
metalfan