I have 9 ArrayLists and I'm trying to condense them all down into one at a given point.
at the moment dotGrid is a matrix of ArrayLists, searchX and searchY simply specify which ArrayLists to add to neighbours.
for(int searchX = sector[0] - 1; searchX < sector[0] + 2; searchX++){
for(int searchY = sector[1] - 1; searchY < sector[1] + 2; searchY++){
if(searchX >= 0 && searchX < 16 && searchY >= 0 && searchY < 16){
neighbours.add(dotGrid[searchX][searchY]);
}
}
}
from what I understand neighbours.addAll() should work, but it isn't.
I really have been searching quite hard, but haven't been able to find a satisfactory answer.
thanks in advance