Mam mały problem, zapisuje do TreeMapa element TreeMapa zdefiniowany to pozniej przy updacie jednego elementu, aktualizuje mi TreeMapa na wszystkich polach, a chce by był tylko na jednym. Jak można to rozwiazać ?
0
0
Juz rozwiązałem problem, jak będzie miał ktoś problem to przykłąd kodu:
TreeMap<Integer, Integer>map2 = new TreeMap<Integer, Integer>();
if (map.get(id) != null) {
map2.putAll(map.get(id));
if (map2.get(id2) != null) {
int tmp = map2.get(id2);
map2.put(Delta, tmp + 1);
map.put(id, map2);
} else {
map2put(id2, 1);
map.put(id, map2);
}
} else {
map2.put(id2, 1);
map.put(id, map2);
}
// moze miec bledy literowe - ostrzegam