ArrayList<int[]> queue = new ArrayList<>();
if (isValid(x, y, colorFill, colorBoundary, graphics)){
int[] add = new int[2];
add[0]=x;
add[1]=y;
queue.add(add);
}
while (!queue.isEmpty()){
int[] get = queue.get(queue.size());
graphics.putPixel(get[0],get[1],colorFill);
queue.remove(queue.size());...}
hey I have problem with geting array from ArrayList queue = new ArrayList<>();. Do you have any suggestions where I have made mistake?
queue.size()toqueue.size()-1if you want to access/remove the last element.ArrayListcannot be of priitive type, try useInteger[](instead of int[])int[]is not a primitive, it inherits fromObject, so it's a legitimate base type for a generic collection.