java - Index Out Of Bounds Exception in ArrayList while removing objects -
platform: jacrere
I generally use for the ends that rely on the back Because the theoretically fall after properly removing them:
0123456789 Even removing the numbers:
i = 9: 0123456789 i = 8 // Remove 8: 012345679 i = 7: 012345679 i = 6 // Remove 6: 01234579 and so on
But when this object is removed, I get an exception:
A (int i = dArea.size ()) -> 1; I> = 0; I--) {if (dArea.get (i) .getOwn () == 1) {if (dArea.get (i) .getSK () == 2) {if (dArea .get (i) .getX ( ) - dArea.get (i) .getW () / 2> 1350) {dArea.remove (i); } If (DARA.Tet (i) .getX () + DARA.Tet (i) .getW () / 2 <0} {DARA.Reth (I); } If (DARAgate (i) .getY () - DARA.Tet (i) .getH () / 2> 685) {DARA.Read (I); } If (DARA.Tet (I) .getY () + DiareaTet (I) .getH () / 2 <0) {DARA (I); }}}}
Why and how to correct any thoughts?
if using else instead of Try to Otherwise, a repetition more than one element in your loop (check 'w' once and 'h' for check).
Comments
Post a Comment