Więc:
HashMapa kluczowana po roku (Integer) a wartościami są:
HashMapa kluczowana po miesiącu (Integer) a wartościami są:
ArrayLista Integerów - wpłat.
Zatem:
HashMap<Integer, HashMap<Integer, ArrayList<Integer>>> dane = ...
ArrayList<Integer> wplaty_01_2012 = dane.get(2012).get(1);
for (Integer wplata : wplaty) {
System.out.println(wplata);
}
Dodanie nowego wpisu:
int rok = 2011;
int miesiac = 05;
int kwota = 100;
if (!dane.containsKey(rok)) {
dane.put(rok, new HashMap<Integer, ArrayList<Integer>>());
}
HashMap<Integer, ArrayList<Integer>> temp = dane.get(rok);
if (!temp.containsKey(miesiac)) {
temp.put(miesiac, new ArrayList<Integer>());
}
ArrayList<Integer> wplaty = temp.get(miesiac);
wplaty.add(kwota);