Re: Retrieving from a List which contains data as HashMap
Posted By:
arnold_espiritu
Posted On:
Monday, September 1, 2003 04:14 AM
Instantiate the HashMap inside the while loop so that what you add in the list is always a new HashMap object,or else you will really get the latest key value pair...Hope that helps..
while (rs.next()) {
HashMap hmap = new HashMap();
hmap.put(key,value);
.............
aList.add(hmap);
}
Re: Retrieving from a List which contains data as HashMap
Posted By:
Anand_Kumar
Posted On:
Thursday, August 28, 2003 03:33 AM
Your logic
while (rs.next()) {
hmap.put(key,value);
.............
aList.add(hmap);
}
is wrong.. Try to look one more time(!!)