Bookmark Topic Watch Topic
  • New Topic

help need in Hashtable elements remove dynamically  RSS feed

 
Bala Raju Mandala
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

I need your help in solving a problem i am facing.

I am reading files from a particular folder and storing them into Hashtable(Key is filename and value is file object).

I need to read this Hashtable for a particular file extention. After getting particular file, i need to search associated files of first file in the same Hashtable. I need to store all these files in a list.

This part is working fine, but problem here is as i am reading the Hashtable sequentially, the same process will repeatin for the each associated file also. I tried to remove the associated files from Hashtable once they found but it is throwing

Exception in thread "main" java.util.ConcurrentModificationException
at java.util.Hashtable$Enumerator.next(Unknown Source)
at HashEx.main(HashEx.java:33)

can anybody give some suggestions so that i can avoid of reading associated files.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please UseOneThreadPerQuestion. You have asked the same question in the beginner forum, so I'll close this one.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!