I'm a newbie studying Android programming using Android Studio, and I have a problem. I try to remove all elements in this list, but at the end, it says the size is 5. Why?
This is my code:
ArrayList<Integer> arr = new ArrayList<Integer>(10);
for(int i=1;i<=10;i++){
arr.add(i);
}
for(int i=0;i<arr.size();i++) {
arr.remove(i);
}
Toast.makeText(getApplicationContext(),
arr.size()+" ",
Toast.LENGTH_LONG).show();