Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

help need in Hashtable elements remove dynamically

 
Ranch Hand
Posts: 40
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22504
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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