Removing From ArrayList, In Loop Based On It's Size, But Breaking After Remove Still Gives OutOfBounds -
OK, so I remove an orange from the array list, break it, but I still get the outbound I am a little confused, someone can help me, I have tried to separate the problem, but I still can not understand it.
Here is an error:
Exception threads "Thread-2" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 on java.util.ArrayList.rangeCheck ( GameFunctions.act at GameFunctions.act on (ArrayList.java:635) at java.util.ArrayList.get (ArrayList.java:411) GameFunctions.act (GameFunctions.java147) GamePanel $ 1.run (GamePanel.java:50)
Here are two methods (if (Actor equivalents ("germ")) {for (int i = 0; i & lt; g.size (); i ++) {if (live .t.T. Examples of Spinumonia) {g.get (i) .move (); G.get (i) .testBounds (); If (Czechs (G, I)) {System.out.println ("broken"); break; }}}} And if (Actor equal ("whiteboard seals")) {for (int i = 0; i & lt; p.size (); i ++) {pgate (i) .setTarget ( Closest goal (G, P. Mill (i))); P.get (i) .move (); }}}
And here the method is said to be removing the object:
The Public Boolean Check Size (ArrayList & lt; Insects & gt; G, int i) {if (g.tate (i) .getRadius ()> 30) {g.get (i) .setRadius (30); } And if (G.Tet (i) .getRadius ()
It seems that there is an error due to error in ArrayList .
View this area of your code:
else if (actor.quick ("whiteblooddale")) {for (int i = 0; i & lt; p .size (); i ++) {p. Zest (I) .setTarget (closest target (G, P. zest (I))); P.get (i) .move (); }}
See if you get any clue.
Edit - The bug is coming from the closest target function based on the exceptions listed.
Comments
Post a Comment