Error changing array for arraylist
in
Programming Questions
•
1 year ago
Hi all!
I have an array but I changed it to arraylist because I don't want it to be fixed. After this change I am getting an error that I don't understand.
This is the part of the code that has the problem, exactly the second line:
From:
for (int i = 0; i < pl.length; i++) {
for (int j = 0; j < gF.size(); j++) pl[i].setNuevaDireccion(gF[j].x, gF[j].y, gF[j].radius, 1500*gF.size(), .4);
for (int j = 0; j < pl.length; j++) {
if ( j != i) pl[i].setNuevaDireccion(pl[j].x, pl[j].y, pl[j].radius, 2000, .6);
}
pl[i].setNuevaPosicion();
}
The second line was working perfect previous this change:
From:
for (int j = 0; j < gF.length; j++) pl[i].setNuevaDireccion(gF[j].x, gF[j].y, gF[j].radius, 1500*gF.length, .4);
To:
for (int j = 0; j < gF.size(); j++) pl[i].setNuevaDireccion(gF[j].x, gF[j].y, gF[j].radius, 1500*gF.size(), .4);
but now I obtain this error "The type of expression must be an array type but it resolved to ArrayList"
any idea??
1