Iterate HashMap to get key and value

單取key或value就不說了~直接for each
若要同時取key & value可以這樣寫

HashMap< String, MyData> myHashMap;
for (Map.Entry< String, MyData> entry : map.entrySet()) {
    String key = entry.getKey();
    MyData value = entry.getValue();
}

沒有留言: