'How do you create a method in objects that finds the highest number using hashmap?

I'm new with hashmap and I'm trying to find the most populous continent using hashmap and I don't know where to go from here.

These are my fields and I want to put the continent in the key section and population in the value section

private String name;
private int population;
private double area;
private String continent;

This is my attempt for creating that method but it's incomplete.

public void findMostPopulousContinent() {
    /* Hashmap<Key, Value> */
    HashMap<String, Integer> dummy = new HashMap<String, Integer>();

    for (int i = 0; i < size; i++) {
        if (dummy.containsKey(catalogue[i].getContinent())) {
            Integer pop = dummy.get(catalogue[i].getContinent());
            pop = pop + catalogue[i].getPopulation();


        }
        else {
            dummy.put(catalogue[i].getContinent(), catalogue[i].getPopulation());
        }
    }
}

What I wanted to happen is to put my instances in the hashmap, and if my instances have the same continent then add their population and then compare that with others and then print the continent with the highest population like

North America, 100000000


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source