I have a program that uses a java.awt robot to get a picture of the screen and then cycle through the pixels and categorize certain colors in blocks in a list of lists of integer arrays. I have a List<List<int[]>> blocks
. The first List is a list of all the blocks, the second list is a list of all the pixels in the blocks, and the integer array is 2 value that are the x and y of the pixel. I first tried to use a for loop through all the blocks with list.contain's to find the array, but that always returned false. I am trying now to use a loop like this to find them.
boolean continuer = false;
boolean found = false;
for (List<int[]> thisBlock : blocks) {
int[] newInt = new int[2];
newInt[0] = i;
newInt[1] = j;
for (int[] thisInt : thisBlock) {
if (thisInt == newInt) {
continuer = false;
found = true;
System.out.println("Found pixel in block");
break;
}
if (found) {
break;
}
}
if (found) {
break;
}
}
if (!found) {
continuer = true;
}
This also returned false always. Any help would be greatly appreciated.