Results 1 to 3 of 3
  1. #1
    tcms is offline Member
    Join Date
    May 2013
    Posts
    43
    Rep Power
    0

    Default ConcurrentModificationException once again

    I'm getting java.util.ConcurrentModificationException when I try to run this code:

    Java Code:
    for(Local x : table.getF_local())
    					if(x.getName().equals(temp.getName())){
    						table.getF_local().remove(x);
    						table.fireTableDataChanged();
    					}
    I already tryed to iterate it but won't work... F_local() is an array
    Last edited by tcms; 11-30-2013 at 02:07 AM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,409
    Rep Power
    25

    Default Re: ConcurrentModificationException once again

    I already tryed to iterate it but won't work.
    Please make a small, complete program that compiles, executes and shows the problem.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    tcms is offline Member
    Join Date
    May 2013
    Posts
    43
    Rep Power
    0

    Default Re: ConcurrentModificationException once again

    Quote Originally Posted by Norm View Post
    Please make a small, complete program that compiles, executes and shows the problem.
    The problem was that I was trying to remove an element of an Array, while the loop was working...So since I know that was the problem, I solved this way:

    Java Code:
    Local temp = null;
    
    				for(Local local : table.getF_local()){
    					if(local.getName().equals(file_pressed.getName()))
    						temp = local;
    				}
    				if(temp!=null){
    					table.getF_local().remove(temp);
    					table.fireTableDataChanged();
    				}
    Last edited by tcms; 11-30-2013 at 02:11 AM.

Similar Threads

  1. java.util.ConcurrentModificationException
    By user92 in forum New To Java
    Replies: 2
    Last Post: 11-02-2012, 05:31 PM
  2. java.util.ConcurrentModificationException
    By mharsijamel in forum New To Java
    Replies: 1
    Last Post: 11-02-2011, 02:40 PM
  3. I'm getting a ConcurrentModificationException
    By gib65 in forum Advanced Java
    Replies: 6
    Last Post: 08-18-2010, 09:45 PM
  4. Getting around a ConcurrentModificationException
    By Newbie666 in forum New To Java
    Replies: 50
    Last Post: 01-26-2010, 02:30 PM
  5. ConcurrentModificationException with ArrayList
    By fogus in forum New To Java
    Replies: 3
    Last Post: 01-15-2009, 04:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •