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
For removing the particular object from arrayList there are two ways. Call the function of arrayList.
arrayList.remove(object);
This will remove your object but in most cases when arrayList contains the items of UserDefined DataTypes, this method does not give you the correct result. It works fine only for Primitive DataTypes. Because user want to remove the item on the basis of object field value and that can not be compared by remove function automatically.
arrayList.remove(index);