I have this code here :
public static void exercise5e() {
List<Hills> hillist = Hills.readHills();
public static Map> hillsByCounty(List hills) {
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;
}
} My hashmap has values of ( hill name , country name , height, longitude and latitude from a list however i need to print only 3 counties with the first 3 hills of each counties and their height how can i do that?enter image description here