This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I'm new to java, I'm nt bale to fix this exception Concurrent Modifiaction, I used a file to read data from it and store it on a linked list
data in my file is of the form
then i read it from the linked list and then store it by grouping them into intemsets using multimaps Map<String, List<String>>.
I need data to be stored like this:
Data gets stored on to the linked list but I'm unable to read it from the list and store it on to multimaps.
These are the errors I'm getting:
java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.next(Unknown Source)
I am sure there is a better way to do this, Please help me and let me know how to fix this exception or a better way to do this.
The error happens when you modify a collection that you're actively iterating over; i.e., if you have a Iterator, and the collection is modified, the next time you use the Iterator, this exception can happen. If you can use a ListIterator instead of an Iterator, that class lets you delete items through the iterator, if that's what you need to do.