I have an arraylist like this:
ArrayList<Integer> numbers = new ArrayList<Integer>();
And let's say the values inside are like:
[0,1,2,3,4,5]
So I'm looping through and I want to remove values from the arraylist while I'm looping through:
for(int i=0; i<numbers.size();i++){
if(numbers.get(i)>2){
numbers.remove(i);
}
}
How would I do this?