I have removed elements from Arraylist using iterator. But after removing size is not reduced and values remains same in Arraylist. I have used ArrayList as a class level variable. Doesn't know why it is not working. Below is my code,
public class MyClass{
private ArrayList<String> valueArrayList;
Iterator itr = valueArrayList.iterator();
while (itr.hasNext())
if (validateFile((String) itr.next())) {
Log.d(LOG_TAG, "values removed");
} else
itr.remove();
}
itr.remove()in else case when validation log displayed in if condition (I.e. "values removed").