Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Concurrent Mod Exception

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy Concurrent Mod Exception

    Hi,

    So I've been working on this program to make tournament matches for beach volley. Now I'm stuck on this one thing I just can't figure out.

    First little info: (I'm Belgian so some words are Dutch)
    -Class Speler: has arraylist with information with which player already has been played (codesLijst)
    -Class Inschrijvingen: makes players sign up with their level and name
    -Class Wedstrijd: makes matches, checks with Inschrijvingen if the players already have played together. If so, gives message that they need to change partner. If not, makes them a team.

    Now if I run the program with fresh players, none of them have had a partner, it works fine. If I make just one new team and the other already exists, it also works fine. It's when I make the two teams with existing records (to see whether they already played together), that the error comes.
    I am aware of what the error means, but I am too noob to solve it.

    I know there's a lot of code duplicate, will clear out eventually, this is just a raw version.

    CLASS SPELER
    import java.util.ArrayList;
     
    public class Speler {
     
    	private Wedstrijden wedstrijd;
    	private Inschrijvingen inschrijving;
    	private String naam, ploeg;
    	private int setPunten, winPunten;
    	private long time;
    	private String code;
    	private ArrayList<String> lijstCodes = new ArrayList<String>();
     
    	public Speler(String spelerNaam, String spelerPloeg, Inschrijvingen inschrijving, Wedstrijden wedstrijd) {
     
    		this.inschrijving = inschrijving;
    		this.wedstrijd = wedstrijd;
    		naam = spelerNaam;
    		ploeg = spelerPloeg;
    	}
     
    	//SETTER
    	public void setPoints(int setPunten, int winPunten){
    		this.setPunten = setPunten;
    		this.winPunten = winPunten;
    	}
     
    	public void setTime(long time) {
    		this.time = time;
    	}
     
    	public void setCode(String code){
    		this.code = code;
    		lijstCodes.add(code);
    	}
     
     
    	//GETTER
    	public String getNaam(){
    		return naam;
    	}
     
    	public String getPloeg(){
    		return ploeg;
    	}
     
    	public ArrayList<String> getCode(){
    		return lijstCodes;
    	}
    }



    CLASS INSCHRIJVINGEN
     
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
     
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
     
    public class Inschrijvingen extends JPanel{
     
     
    	private Wedstrijden wedstrijd;
    	private Menu frame;
    	private JButton buttonNewInschrijving;
    	private JTextField txtNewPerson;
    	private JComboBox<String> comboBoxPloeg;
    	private ArrayList<Speler> spelersLijst;
    	private Speler newPlayer;
     
    	public Inschrijvingen(Menu frame) {
     
    	this.frame = frame;
     
    	String[] stringPloegen = { "H1", "H2", "D1", "D2", "D3" };
    	comboBoxPloeg  = new JComboBox<String>(stringPloegen);
    	spelersLijst = new ArrayList<Speler>();
     
    	setLayout(new FlowLayout());
    	buttonNewInschrijving = new JButton("Schrijf in!");
    	txtNewPerson = new JTextField(20);
     
     
    	add(txtNewPerson);
    	add(buttonNewInschrijving);
     
    	buttonNewInschrijving.addActionListener(new EventHandlerAll());
     
    	}
     
    	public ArrayList<Speler> getSpelers() {
    		return spelersLijst;
    	}
     
    	class EventHandlerAll implements ActionListener {
    		public void actionPerformed(ActionEvent e) {
     
    			if(e.getSource() == buttonNewInschrijving) {
    				String tmpPloeg = (String)comboBoxPloeg.getSelectedItem();
    				String tmpNewPlayer = txtNewPerson.getText();
    				newPlayer = new Speler(tmpNewPlayer, tmpPloeg, frame.getInschrijving(), frame.getWedstrijd());				
    				spelersLijst.add(newPlayer);
    				txtNewPerson.grabFocus();
    				txtNewPerson.selectAll();
     
    				for(Speler sss: spelersLijst){
    				System.out.println(sss.getNaam());
    				}
     
    			}
    		}
    	}
    }



    CLASS WEDSTRIJDEN (MAIN CLASS)
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
     
    import javax.swing.ButtonGroup;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTextField;
     
    public class Wedstrijden extends JPanel{
     
    	private Inschrijvingen inschrijving;
    	private Menu frame;
    	private Speler ploegSpeler;
    	private JPanel panelSpelers, panelButtons;
    	private JButton buttonNextMatch, buttonPreviousMatch, buttonMakeMatch, buttonViewAllMatches, buttonRegisterMatch, buttonSearchMatch;
    	private JLabel lblX1, lblX2;//, lblSpeler1, lblSpeler2, lblSpeler3, lblSpeler4;
    	private JTextField txtSpeler1, txtSpeler2, txtSpeler3, txtSpeler4;
    	private JRadioButton radioWinA, radioWinB;
    	private String code;
    	private ArrayList<String> codesLijst = new ArrayList<String>();
    	private int wedstrijdNr, arraySize;
     
     
    	public Wedstrijden(Inschrijvingen inschrijving, Menu frame) {
     
    		wedstrijdNr = 1;
     
    		this.inschrijving = inschrijving;
    		this.frame = frame;
     
    		panelSpelers = new JPanel();
    		panelButtons = new JPanel();
     
    	}
     
    	private void makePloeg() {
     
    		for (Speler sp1: inschrijving.getSpelers()){
    			ploegSpeler = sp1;
    			arraySize = ploegSpeler.getCode().size();
    			if(ploegSpeler.getNaam().equalsIgnoreCase(txtSpeler1.getText())){
    				if(arraySize == 0){
    					makeCodePloeg1();
    				}else makePloegNotSamePlayers1();
    			}else{
    			if(ploegSpeler.getNaam().equalsIgnoreCase(txtSpeler3.getText())){
    				if(arraySize == 0){
    					makeCodePloeg2();
    				}else{ makePloegNotSamePlayers2();
    				System.out.println("HIER KOMT EM OPOK!");
    				}
    			}
    			}
    		}
    	}
     
    	private void makePloegNotSamePlayers1() {
    			for (String s1: ploegSpeler.getCode()){
    				for (Speler sp2: inschrijving.getSpelers()){
    					if(sp2.getNaam().equalsIgnoreCase(txtSpeler2.getText())){
    						for (String s2: sp2.getCode()){
    							if(s2.equalsIgnoreCase(s1)){
    								//HERE BE CHANGE PLOEG
    								System.out.println("HERE BE CHANGE PLOEG1");
    							}else{
    								//LOOK AT THE TIME, IS IT THAT LATE ALREADY?
    								//ONE'S IN TXT WILL MAKE NEW TEAM
    								makeCodePloeg1();
    								System.out.println("NEW TEAM MADE 1");
    							}
    						}
    					}
    				}
     
    			}
    	}
     
    	private void makePloegNotSamePlayers2() {
    		Same as makePloegNotSamePlayers1(), but with txtSpeler4 instead of txtSpeler2
    	}
     
    	private void makeCodePloeg1() {
    		Same as makeCodePloeg2(), but with txtSpeler1 and txtSpeler2 instead of txtSpeler3 and txtSpeler4
    	}
     
    	private void makeCodePloeg2() {
    		//CODE FOR SEARCH
    		String tmpFirst2for1 = txtSpeler3.getText().substring(0, 2);
    		String tmpFirst2for2 = txtSpeler4.getText().substring(0, 2);
    		String tmpCode = tmpFirst2for1 + tmpFirst2for2 + wedstrijdNr;
    		//END
     
    		//CODE FOR COMPARISON
    		String tmpPloeg3 = null;
    		String tmpPloeg4 = null;
     
    		tmpPloeg3 = ploegSpeler.getPloeg();
     
    		for (Speler getPloeg: inschrijving.getSpelers()){
    			if(getPloeg.getNaam().equalsIgnoreCase(txtSpeler4.getText())){
    				tmpPloeg4 = getPloeg.getPloeg();
    			}	
    		}
    		String tmpCodeC = txtSpeler3.getText() + tmpPloeg3 + txtSpeler4.getText() + tmpPloeg4;
    		//END	
     
    		if(arraySize == 0){
    			for(Speler speler2Code: inschrijving.getSpelers()){
    				if(speler2Code.getNaam().equalsIgnoreCase(txtSpeler4.getText())){
    					speler2Code.setCode(tmpCodeC);
    					codesLijst.add(tmpCode);
    					System.out.println(tmpCode + " Speler 4");
    					System.out.println(tmpCodeC);
    				}
    			}
    		}else{
    			for(String stringCode: ploegSpeler.getCode()){
    				if(stringCode.equalsIgnoreCase(tmpCodeC)){
    					System.out.println("HIER KOMT EM DAN WEL voor 2");
    				}else{
    					for(Speler speler2Code: inschrijving.getSpelers()){
    						if(speler2Code.getNaam().equalsIgnoreCase(txtSpeler4.getText())){
    							speler2Code.setCode(tmpCodeC);
    							codesLijst.add(tmpCode);
    							System.out.println(tmpCode + " Speler 4");
    							System.out.println(tmpCodeC);
    						}
    					}
    				}
    			}
    		}
     
    		if(ploegSpeler.getNaam().equalsIgnoreCase(txtSpeler3.getText())){
    			ploegSpeler.setCode(tmpCodeC);
    			System.out.println(tmpCode + " Speler 3");
    		}
    	}
     
    	//EVENTHANDLER
    	class EventHandlerAll implements ActionListener {
    		public void actionPerformed(ActionEvent e) {
     
    			if(e.getSource() == buttonMakeMatch){
    				makePloeg();
    				wedstrijdNr++;
    			}
     
    			if(e.getSource() == buttonSearchMatch){
    				System.out.println(codesLijst);
    			}
     
    			//REGISTER MATCH
    			if(e.getSource() == buttonRegisterMatch){
    				if(radioWinA.isSelected()) {
    					String tmpWinner1 = txtSpeler1.getText();
    					String tmpWinner2 = txtSpeler2.getText();
    					for( Speler s: inschrijving.getSpelers()){
    						if(s.getNaam().equalsIgnoreCase(tmpWinner1)){
    							s.setPoints(3, 1);
    						}
    						if(s.getNaam().equalsIgnoreCase(tmpWinner2)){
    							s.setPoints(3, 1);
    						}
    					}
    				}else
     
    				if(radioWinB.isSelected()){
    					String tmpWinner1 = txtSpeler3.getText();
    					String tmpWinner2 = txtSpeler4.getText();
    					for( Speler s: inschrijving.getSpelers()){
    						if(s.getNaam().equalsIgnoreCase(tmpWinner1)){
    							s.setPoints(3, 1);
    						}
    						if(s.getNaam().equalsIgnoreCase(tmpWinner2)){
    							s.setPoints(3, 1);
    						}
    					}
    				}
    			}
    		}
    	}
    }


    ERROR CODE
    JoJi2 Speler 4
    JorgH1JillD2
    JoJi2 Speler 3
    NEW TEAM MADE 2
    Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
    	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:886)
    	at java.util.ArrayList$Itr.next(ArrayList.java:836)
    	at me.kevoc.beach.Wedstrijden.makePloegNotSamePlayers2(Wedstrijden.java:174)
    	at me.kevoc.beach.Wedstrijden.makePloeg(Wedstrijden.java:140)
    	at me.kevoc.beach.Wedstrijden.access$1(Wedstrijden.java:125)
    	at me.kevoc.beach.Wedstrijden$EventHandlerAll.actionPerformed(Wedstrijden.java:302)


    Will be very grateful to anyone who can help me with this
    Last edited by Praijer; August 11th, 2014 at 05:00 AM.


  2. #2
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: Concurrent Mod Exception

    Fast enumerations like this:
    for (Speler sp1: inschrijving.getSpelers()){
     
    }

    Create an iterator. Iterators are designed to fail fast when you directly modify a collection while iterating over it because it puts the iterator in an unstable state.

    Check out what is happening at this line:
    me.kevoc.beach.Wedstrijden.makePloeg(Wedstrijden.j ava:140)
    Computers are fascinating machines, but they're mostly a reflection of the people using them.
    -- Jeff Atwood

  3. The Following 2 Users Say Thank You to ChristopherLowe For This Useful Post:

    GregBrannon (August 11th, 2014), Praijer (August 11th, 2014)

  4. #3
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Concurrent Mod Exception

    Alright, I've done some rework to the code.

    Still getting the same error

    I know it's a lot of code, but the error can come from anywhere I believe.. :/

    ERROR MESSAGE:
    Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
    	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:886)
    	at java.util.ArrayList$Itr.next(ArrayList.java:836)
    	at me.kevoc.beach.Wedstrijden.makePloegske(Wedstrijden.java:230)
    	at me.kevoc.beach.Wedstrijden.makePloeg(Wedstrijden.java:157)
    	at me.kevoc.beach.Wedstrijden.access$13(Wedstrijden.java:132)
    	at me.kevoc.beach.Wedstrijden$EventHandlerAll.actionPerformed(Wedstrijden.java:408)

    private void makePloeg() { /** HERE IS THE at me.kevoc.beach.Wedstrijden.access$13(Wedstrijden.java:132)*/
    		Iterator<Speler> itSpelers =  inschrijving.getSpelersHeren().iterator();
    		System.out.println("OK");
     
    		while(itSpelers.hasNext()){
    			ploegSpeler = itSpelers.next();
    			arraySize = ploegSpeler.getCode().size();
    			System.out.println("OK1 " + ploegSpeler.getNaam() + " " + arraySize);
     
    				if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtA)){
    					System.out.println("OK2");
    					if(arraySize == 0){
    						makeCode();
    						System.out.println("Makes code 1");
     
    					}else makePloegske();System.out.println("OK3");
     
    				}else{
     
    					if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtC)){
    						System.out.println("OK4");
    						if(arraySize == 0){
    							makeCode();
    							System.out.println("Makes code 2");
     
    						}else makePloegske();System.out.println("OK5"); /**HERE IS THE at me.kevoc.beach.Wedstrijden.makePloeg(Wedstrijden.java:157) */
    					}
    				}
    		}
    	}

    private void makePloegske() {
    		System.out.println("NOK " + ploegSpeler.getNaam() + " " + stringTxtA);
     
    		Iterator<Speler> itSpelersTmp =  inschrijving.getSpelersDames().iterator();
     
    		if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtA)){
    			System.out.println("NOK1");
     
    			Iterator<String> itStringTmp =  ploegSpeler.getCode().iterator();
     
    			while(itStringTmp.hasNext()){
    				String tmpString = itStringTmp.next();
     
    			//for (String s1: ploegSpeler.getCode()){
    				System.out.println("NOK2");
     
    				while(itSpelersTmp.hasNext()){
    					Speler tmpSpeler = itSpelersTmp.next();
     
    				//for (Speler sp2: inschrijving.getSpelersDames()){
    					System.out.println("NOK3");
    					if(tmpSpeler.getNaam().equalsIgnoreCase(stringTxtB)){
    						System.out.println("NOK4");
     
    						Iterator<String> itStringTmp2 =  tmpSpeler.getCode().iterator();
     
    						while(itStringTmp2.hasNext()){
    							String tmpString2 = itStringTmp2.next();
     
    						//for (String s2: tmpSpeler.getCode()){
    							System.out.println("NOK5");
    							if(tmpString2.equalsIgnoreCase(tmpString)){
    								//MAKE NEW TEAM PLEAZE
    								System.out.println("MAKE NEW TEAM PLEAZE | MAKE PLOEGSKE | TEAM 1");
    							}else{
    								makeCode();
    								System.out.println("NEW TEAM 1 MADE");
    							}
    						}
    					}
    				}
    			}
    		}else{
    			System.out.println("NNOK " + ploegSpeler.getNaam() + " " + stringTxtC);
    		if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtC)){
    			System.out.println("NNOK1");
     
    			Iterator<String> itStringTmp =  ploegSpeler.getCode().iterator();
     
    			while(itStringTmp.hasNext()){
    				String tmpString = itStringTmp.next();
     
    		//	for (String s1: ploegSpeler.getCode()){
    				System.out.println("NNOK2");
     
    				while(itSpelersTmp.hasNext()){
    					Speler tmpSpeler = itSpelersTmp.next();
     
    				//for (Speler sp2: inschrijving.getSpelersDames()){
    					System.out.println("NNOK3");
    					if(tmpSpeler.getNaam().equalsIgnoreCase(stringTxtD)){
    						System.out.println("NNOK4");
     
     
    						Iterator<String> itStringTmp2 =  tmpSpeler.getCode().iterator();
     
    						while(itStringTmp2.hasNext()){
    							String tmpString2 = itStringTmp2.next();  /**HERE IS THE at me.kevoc.beach.Wedstrijden.makePloegske(Wedstrijden.java:230) */
     
    						//for (String s2: sp2.getCode()){
    							System.out.println("NNOK5");
    							if(tmpString2.equalsIgnoreCase(tmpString)){
    								//MAKE NEW TEAM PLEAZE
    								System.out.println("MAKE NEW TEAM PLEAZE | MAKE PLOEGSKE | TEAM 2");
    							}else{
    								makeCode();
    								System.out.println("NEW TEAM 2 MADE");
    							}
    						}
    					}
    				}
    			}
    		}
    		}
    	}

    private void makeCode() {
     
    		//CHECK FOR TXTSPELER1
    		//CODE FOR SEARCH
    		if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtA)){
     
    		String tmpFirst2for1 = (stringTxtA).substring(0, 2);
    		String tmpFirst2for2 = (stringTxtB).substring(0, 2);
    		String tmpCode = tmpFirst2for1 + tmpFirst2for2 + wedstrijdNr;
    		//END
     
    		//CODE FOR COMPARISON
    		String tmpPloeg1 = null;
    		String tmpPloeg2 = null;
     
    		tmpPloeg1 = ploegSpeler.getPloeg();
     
    		for (Speler getPloeg: inschrijving.getSpelersDames()){
     
    			if(getPloeg.getNaam().equalsIgnoreCase(stringTxtB)){
    				tmpPloeg2 = getPloeg.getPloeg();
    			}	
    		}
    		String tmpCodeC = stringTxtA + tmpPloeg1 + stringTxtB + tmpPloeg2;
    		//END	
    		System.out.println( tmpCodeC + " " + tmpCode);
     
    			Iterator<Speler> itSpelers =  inschrijving.getSpelersDames().iterator();
     
    			while(itSpelers.hasNext()){
    				Speler sp1 = itSpelers.next();
     
    				if(sp1.getCode().size() == 0){
     
    					if(sp1.getNaam().equalsIgnoreCase(stringTxtB)){
    						sp1.setCode(tmpCodeC);
    						codesLijst.add(tmpCode);
    						System.out.println(tmpCode + " Speler 2");
    						System.out.println(tmpCodeC);
    					}
    			}else{
     
    				Iterator<String> itCodes =  ploegSpeler.getCode().iterator();
     
    				while(itCodes.hasNext()){
    					String c1 = itCodes.next();
     
    				if(c1.equalsIgnoreCase(tmpCodeC)){
    						System.out.println("MOET ANDER TEAM WORDEN GEMAAKT");
    				}else{
     
    					if(sp1.getNaam().equalsIgnoreCase(stringTxtB)){
    						sp1.setCode(tmpCodeC);
    						codesLijst.add(tmpCode);
    						System.out.println(tmpCode + " Speler 2");
    						System.out.println(tmpCodeC);
    					}
    				}
    				}
    			}
     
    		}
     
    		if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtA)){
    			ploegSpeler.setCode(tmpCodeC);
    			System.out.println(tmpCode + " Speler 1");
    		}		
    		}else{
     
     
    			//------------------------------------------------------------------------------------------
     
    			//CHECK FOR TXTSPELER3
     
    			//------------------------------------------------------------------------------------------
    			if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtC)){
     
    				String tmpFirst2for1 = (stringTxtC).substring(0, 2);
    				String tmpFirst2for2 = (stringTxtD).substring(0, 2);
    				String tmpCode = tmpFirst2for1 + tmpFirst2for2 + wedstrijdNr;
    				//END
     
    				//CODE FOR COMPARISON
    				String tmpPloeg1 = null;
    				String tmpPloeg2 = null;
     
    				tmpPloeg1 = ploegSpeler.getPloeg();
     
    				for (Speler getPloeg: inschrijving.getSpelersDames()){
     
    					if(getPloeg.getNaam().equalsIgnoreCase(stringTxtD)){
    						tmpPloeg2 = getPloeg.getPloeg();
    					}	
    				}
    				String tmpCodeC = stringTxtC + tmpPloeg1 + stringTxtD + tmpPloeg2;
    				//END	
    				System.out.println( tmpCodeC + " " + tmpCode);
     
    					Iterator<Speler> itSpelers =  inschrijving.getSpelersDames().iterator();
     
    					while(itSpelers.hasNext()){
    						Speler sp1 = itSpelers.next();
     
    						if(sp1.getCode().size() == 0){
     
    							if(sp1.getNaam().equalsIgnoreCase(stringTxtD)){
    								sp1.setCode(tmpCodeC);
    								codesLijst.add(tmpCode);
    								System.out.println(tmpCode + " Speler 2");
    								System.out.println(tmpCodeC);
    							}
    					}else{
     
    						Iterator<String> itCodes =  ploegSpeler.getCode().iterator();
     
    						while(itCodes.hasNext()){
    							String c1 = itCodes.next();
     
    						if(c1.equalsIgnoreCase(tmpCodeC)){
    								System.out.println("MOET ANDER TEAM WORDEN GEMAAKT");
    						}else{
     
    							if(sp1.getNaam().equalsIgnoreCase(stringTxtD)){
    								sp1.setCode(tmpCodeC);
    								codesLijst.add(tmpCode);
    								System.out.println(tmpCode + " Speler 2");
    								System.out.println(tmpCodeC);
    							}
    						}
    						}
    					}
     
    				}
     
    				if(ploegSpeler.getNaam().equalsIgnoreCase(stringTxtC)){
    					ploegSpeler.setCode(tmpCodeC);
    					System.out.println(tmpCode + " Speler 1");
    				}				
    				}
    		}
     
    	}
    Last edited by Praijer; August 11th, 2014 at 01:16 PM.

  5. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Concurrent Mod Exception

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/91736-concurrent-mod-exception.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #5
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Concurrent Mod Exception

    Oooo, I thought cross-posting meant something else >.<

  7. #6
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Concurrent Mod Exception

    Have you thought about using a debugger? That is an awful lot of code
    to sift through and I doubt anyone has the time to do it.

    What I can suggest is maybe creating a test program that contains code very
    similar to the code the compiler has noted - and see if you can get it to work.
    If you can, use a similar algorithm to solve the problem in the actual project.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  8. #7
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Concurrent Mod Exception

    Quote Originally Posted by Ada Lovelace View Post
    Have you thought about using a debugger? That is an awful lot of code
    to sift through and I doubt anyone has the time to do it.

    What I can suggest is maybe creating a test program that contains code very
    similar to the code the compiler has noted - and see if you can get it to work.
    If you can, use a similar algorithm to solve the problem in the actual project.

    Wishes Ada xx
    Thanks for your comment!

    But I've completely rewritten my code because it wasn't very clean code and not very good code. I've made it much simpler now and haven't had any errors so far.

    In respons to your comment: I was using the debugger, with little results Still need to learn a lot as the language never ends IMO :p

Similar Threads

  1. Java Course Issues (Mod 5)
    By Damarshn in forum What's Wrong With My Code?
    Replies: 10
    Last Post: March 18th, 2013, 05:42 AM
  2. Avoiding concurrent modification exception?
    By Twon23 in forum Collections and Generics
    Replies: 4
    Last Post: November 12th, 2012, 11:34 AM
  3. Replies: 3
    Last Post: February 9th, 2012, 01:04 PM
  4. mod 95 vigninere cipher
    By fortune2k in forum Algorithms & Recursion
    Replies: 4
    Last Post: December 5th, 2010, 09:43 PM
  5. concurrent programming
    By abc in forum Threads
    Replies: 10
    Last Post: June 29th, 2010, 07:06 AM