Ineed to know the best way to modify this code so that the output is "John".
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Bowling {
public static > Map.Entry getMaxEntryInMapBasedOnValue(Map map) {
Map.Entry entryWithMaxValue = null;
for (Map.Entry currentEntry : map.entrySet()) {
if (entryWithMaxValue == null || currentEntry.getValue().compareTo(entryWithMaxValue.getValue()) > 0) {
entryWithMaxValue = currentEntry; } } return entryWithMaxValue; }
public static void print(Map map) { System.out.print("Map: "); if (map.isEmpty()) { System.out.println("[]"); }
else {
System.out.println(map); } }
public static void main(String[] args) { Map map = new HashMap<>();
map.put("John", 100);
map.put("James", 55);
map.put("Julie", 98); System.out.println(getMaxEntryInMapBasedOnValue(map)); } }