java hashmap flaws ?

Posted by Tiberiu Hajas on Stack Overflow See other posts from Stack Overflow or by Tiberiu Hajas
Published on 2010-03-16T21:16:47Z Indexed on 2010/03/16 21:21 UTC
Read the original article Hit count: 217

Filed under:
|

hi there,

  if (agents != null)
         for (Iterator iter = agents.keySet().iterator(); iter .hasNext();)
         {
           // some stuffs here
         }

I have the following piece of java code, the agents is a hashmap, wondering if anyone can figure it out why on the line with "for" statement sometimes I got NPE ? is there any flaw with hashmaps ? thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about hashmap