So basically I have a map that looks like this
HashMap<Integer, HashMap<String, Integer>> girls =
new HashMap<Integer, HashMap<**String**, Integer>>();'
and I want to return the bolded string and this is my method so far
public String getGirlName(int year, int rank) { //year refers to Key
//rank refers to other integer in value map
if (girls.containsKey(year) && girls.get(year).containsKey(rank)){
//shouldn't this return the name
return girls.get(year).get(rank); //error here where it says I can't return an integer I have to return a string
else return null;
}
}
I'm not sure how to do the above title