How can I remove specific object from ArrayList? Suppose I have a class as below:
import java.util.ArrayList;
public class ArrayTest {
int i;
pu
If you want to remove multiple objects that are matching to the property try this.
I have used following code to remove element from object array it helped me.
In general an object can be removed in two ways from an ArrayList (or generally any List), by index (remove(int)) and by object (remove(Object)).
some time for you arrayList.remove(index)or arrayList.remove(obj.get(index)) using these lines may not work try to use following code.
for (Iterator iter = detailInboxArray.iterator(); iter.hasNext(); ) {
DetailInbox element = iter.next();
if (element.isSelected()) {
iter.remove();
}
}