I have this code here :
public static void exercise5e() {
List<Hills> hillist = Hills.readHills();
公共靜態地圖> hillsByCounty(名單丘陵){我如何從HashMap中提取和打印特定值?
HashMap<String, Set<Hills>> hashMap = new HashMap<String, Set<Hills>>();
// List<Hills> hillist = Hills.readHills();
for (Hills h : hillist) {
String key = h.countryname;
} else {
Set<Hills> set = new TreeSet<Hills>();
set.add(h);
hashMap.put(key, set);
}
}
System.out.println(hashMap1);
return hashMap1;
}
}但是我只需要打印 我的HashMap具有(山名,國名,高度,經度和緯度從列表中的值3個縣,每個縣的前3個丘陵和他們的身高我該怎麼辦呢?enter image description here
可能重複[Java Hashmap:如何從值中獲取密鑰?](http://stackoverflow.com/questions/1383797/java-hashmap-how-to-get-key-from-value) – Fizz