I have the code below:
Hashtable<Integer, List<Model>> map = new Hashtable<Integer, List<Model>>();
for (int i = 0; i < arraylistAssignment.size(); i++) {
List<Model> temp = null;
for (int j = 0; j < arraylistModel.size(); j++) {
if (arraylistAssignment.get(i).getId() == arraylistModel.get(j)
.getId()) {
if (temp == null)
temp = new ArrayList<Model>();
temp.add(arraylistModel.get(j));
}
}
map.put(arraylistAssignment.get(i).getId(), temp);
}
In the above code, at debug point 1, when I integrated the temporary variable in hv, the size of the object is 0 like showm below:

but as soon as I add ie temp.add, the size is 1, but the creation of the objects is 12, of which 11 values โโare zero, as shown below ... I could not understand the reason for the zero values โโhere, maybe someone from plz exaplin. ..mi initilzing wrong?


source
share