Why does the top code work and the bottom one not? They are the same code after all.......... public static int getSameLastNameCount(HashMap<String, String> map, String lastName) { //write your code here int counter = 0; // counter for same first name for (HashMap.Entry<String, String> pair : map.entrySet()) { if (pair.getKey().equalsIgnoreCase(lastName)) counter++; } return counter; /* int lastNameCount = 0; for (HashMap.Entry<String, String> pair : map.entrySet()){ if(pair.getKey().equalsIgnoreCase(lastName)); lastNameCount++; } return lastNameCount; */