Il seguente metodo ritorna una mappa che associa ad un mese una lista con glistudenti nati in quel mese :

Esempio:

– se un'aula contiene un insieme con i seguenti studenti:

{<"00","gen">, <"11","gen">, <"54","ott">,<"24","mar">,<"32", "mar">}

– il metodo meseDiNascita2studenti() deve restituire una mappa con le seguenti coppie :

chiave --> valore :

"gen" --> {<"00", "gen">,<"11", "gen">}

"ott" --> {<"54", "ott">}

"mar" --> {<"32", "mar">,<"24", "mar">}

codice:
public Map<String, List<Studente1>> meseDiNascita2studenti() {

        List<Studente1> tmp;

        Map<String, List<Studente1>> mappa;

        mappa = new HashMap<String, List<Studente1>>();

        for(Studente1 studente : this.studenti){

            tmp = mappa.get(studente.getMeseDiNascita());

            if (tmp==null)

                tmp = new ArrayList<Studente1>();

            tmp.add(studente);

            mappa.put(studente.getMeseDiNascita(), tmp);

        }

        return mappa;

    }
Qualcuno riesce gentilmente a spiegarmi i passi dell'algoritmo?
Non mi è chiara soprattuto l'assegnazione " tmp = mappa.get(studente.getMeseDiNascita()); ";

Grazie mille