How to get the string with more ocurrences in a list
<p>I have a List of Strings and I'm trying to have a method that tells me which String has more occurrences in the List.</p>

<p>Here is what I've done so far:</p>

<pre>
package codekata;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OcurrenciasEnLista {

    public static void main(String[] args) {

        List lista = new ArrayList();
        lista.add("test");
        lista.add("foo");
        lista.add("foo");
        lista.add("foo");
        lista.add("bar");
        lista.add("crack");
        moreOftenWord(lista);
    }

    private static void moreOftenWord(List lista) {
        Map mapa = new HashMap();

        for (String palabra: lista)
            addOrIncrementCount(mapa, palabra);


    }

    private static void addOrIncrementCount(Map counters,
            String toAdd) {

        Integer currValue = counters.get(toAdd);
        if (currValue == null)
            counters.put(toAdd, 1);
        else
        {
            counters.put(toAdd, currValue + 1);
        }
    }
}
</pre>

<p>What I don't know how to do is to return -the word- already in the <code>moreOftenWord</code> method.</p>

<p>Can anybody give me a clue on this?</p>
