Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HashMap entries disappear !!

807605Jul 22 2007 — edited Jul 22 2007
Hey Guys,

This is my code snippet:
HashMap map = null;
try{
-- map = new HashMap();
--connect to DB
while(rs.next()){
// do some calculations...etc..etc..

map.put(x,y);
}

}catch(xxxx)

return map;

} //method closes

On the line map.put(..) I can see that the items do get inserted into the map.
When I do map.size() before return map, it shows size=1 where as map.put was called four times , hence four items were inserted.

Any clues ??

thanks !

AZ
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2007
Added on Jul 22 2007
11 comments
1,264 views