chico9 0 Newbie Poster

Hi all,

I'm working on a Hanjie solver and this is part of the code. Everything else seems okay but I always get an error when I run it.

Eclipse (i'm using Galileo version) points the exception to be at:

char a = combo1.get(i).charAt(i);

combo1
...refers to a List<String> of all possible combinations of black and white assignments (where '1' represents black and white '0').

Essentially, this code snippet supposedly picks the first item (a string of 1s and 0s), gets the character at a particular position and compares it with the characters in the same position in the rest of the items in the list. Apparently, if they overlap, then this assignment should be applied to the line.

I'm assuming the error (which Eclipse gives as java.lang.IndexOutOfBoundsException) must be to do with something other than this particular line but I'm just curious if there IS anything wrong with this part itself.

There's a whole lot of code surrounding this one and I don't want to paste the whole thing lest it confuses myself and anyone else more.

And another question; when removing an item from a list, does everything after/before it shift up/down?

Thanks in advance

//now finding overlapping assignments in the possible combinations leftover from the eliminations...
		
		for ( i = 0; i < line.size(); i++)
		{
			boolean same = false;
			char a = combo1.get(i).charAt(i);
			int postn = 0;
			for (int x = 1; x < combo1.size(); x++)
			{
				if (combo1.get(x).charAt(i) == a)
				{
					same = true;
					postn = x;
				}
			}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.