Greetings, I am wondering if anyone can give me a nudge with some code I have been debugging since yesterday.
I am sorting pixels stored as int[2] into groups. Each group is an ArrayList<int[]> called group. The groups are collected into a Hashtable called groups.
For each new pixel x,y I want the routine to run through all the groups in the Hashtable and see if x,y is already in one of the groups . If the pixel is already in one of the groups, it breaks this loop and if it is not there, it starts a new group.
My ArrayList appears to think every pixel it comes across is already in the group. I cannot figure it out! Perhaps the problem is visible from this snippet:
Considering pixel: 1 1 on groups size 0
adding to new group: 1 1
New group groupkey: 0
New group size is: 1
...
put in group number 0
Considering pixel: 1 2 on groups size 1
m is now: 0
test group size: 1
item number 0 is 1 2
...
Considering pixel: 2 1 on groups size 1
m is now: 0
test group size: 1
item number 0 is 2 1
...
And so, the routine always thinks the new number and nothing else is in the group. I am totally stumped. Any help would be most welcome. Thank you, Eric.