Concurrent Modification Exception (tried google)

Hi there, it’s me again.
I was working on my crappy pathfinder system and just simply deleted it and took a re-look at the tutorial:
url=http://www.policyalmanac.org/games/aStarTutorial.htm The best A* Tutorial out there.[/url]

And then I made up something better with Squares and a faster script. But the only place where I have trouble is iterating over the open(and closed (I think) as it is the same) list:

 	  ArrayList<Square> nodes = new ArrayList<Square>();
		open = new ArrayList<Square>();
		closed = new HashSet<Square>();
		Square start = new Square(sx, sy, 0, 0, gx, gy);
		getOpen().add(start);
		changeToClosedList(start);
		checkAroundSquare(sx, sy, gx, gy);
		
		boolean isFinding = true;
		while(isFinding){
			int lowestF = -1;
			Square nextSquare = null;
			for(Iterator<Square> it = open.iterator(); it.hasNext();){ //Throwing a Concurrent Modification Exception.
				Square s = it.next();
				if(lowestF == -1 || lowestF > s.f){
					if(s.h == 0)
						isFinding = false;
					lowestF = s.f;
					nextSquare = s;
				}
				if (nextSquare != null){
					changeToClosedList(nextSquare);
					checkAroundSquare(nextSquare.sx, nextSquare.sy, gx, gy);
				} else 
					return null;
			}
			
		}

It is probably a small thing I died wrong (as always). Before I changed my code to: My “tried google”
I had a synchronized ArrayList (but that also didn’t worked).

If you want to see more codes, just ask me.
I know I post many topics, but you can’t learn things without askin’ them.
-RoseSlayer

changeToClosedList or checkAroundSquare must be modifying the open list, and they shouldn’t be.

Thanks, I see what I did wrong: I wrote to fast. It should’ve been:

while(isFinding){
			int lowestF = -1;
			Square nextSquare = null;
			for(Iterator<Square> it = open.iterator(); it.hasNext();){ //Throwing a Concurrent Modification Exception.
				Square s = it.next();
				if(lowestF == -1 || lowestF > s.f){
					if(s.h == 0)
						isFinding = false;
					lowestF = s.f;
					nextSquare = s;
				}
			}
			
			if (nextSquare != null){
				changeToClosedList(nextSquare);
				checkAroundSquare(nextSquare.sx, nextSquare.sy, gx, gy);
				
			} else 
					return null;
			
		}

Thanks (I should look better before posting)
-RoseSlayer

No problem, I hope you appreciate my diligent investigative work!

O, when did JGO add that feature? Never saw it before -,-…