thanks for the tip. changed it to:
if (showInfo.size() > 5) {
int sz = showInfo.size();
for (int i = 0; i < sz-5; i++) {
showInfo.remove(i);
}
}
thanks for the tip. changed it to:
if (showInfo.size() > 5) {
int sz = showInfo.size();
for (int i = 0; i < sz-5; i++) {
showInfo.remove(i);
}
}
That is almost certainly not what you want.
for (int i = 0; i < N; i++) showInfo.remove(i);
this ‘unrolls’ to:
showInfo.remove(0); showInfo.remove(1); showInfo.remove(2); showInfo.remove(3); ...
Started with: A,B,C,D,E,F,G,H,I
Remove index 0 => B,C,D,E,F,G,H,I
Remove index 1 => B,D,E,F,G,H,I
Remove index 2 => B,D,F,G,H,I
Remove index 3 => B,D,F,H,I
While you want:
for (int i = 0; i < N; i++) showInfo.remove(0);
Started with: A,B,C,D,E,F,G,H,I
Remove index 0 => B,C,D,E,F,G,H,I
Remove index 0 => C,D,E,F,G,H,I
Remove index 0 => D,E,F,G,H,I
Remove index 0 => E,F,G,H,I
Which is why I advised you to use removeFirst()