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!

How to insert element to a HashMap while iterating it ?

807580Aug 24 2010 — edited Aug 25 2010
Hi all,

I have a HashMap having <key, value> as <file name, size of file>.
Before iterating HashMap is loaded with some <key, value> pairs.

While iterating it I'm trying to find all files matching particular key (Pattern created from file name) and insert to the same HashMap.
This ends with a "ConcurrentModificationException".

Is there an alternative way of doing this within one loop ?


Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2010
Added on Aug 24 2010
6 comments
1,321 views