Remove element object from List / ArrayList in Java


Removing object / element in List / ArrayList in Java a bit tricky. For instance, if we have ArrayList(); then we can remove the element using :

1
listItem.remove(new Integer(index));

But this way not working for listItem contains objects. To remove, we should pass object itself.

1
listItem.remove(Object);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.