The remove(Object O) method of Java AbstractCollection is to remove a particular element from a Collection.
Parameters: The parameter O is of the type of Collection and specifies the element to be removed from the collection.
Return Value: This method returns True if the element specified in the parameter is initially present in the collection and is successfully removed otherwise it returns False.
Below program illustrate the Java.util.AbstractCollection.remove() method:
Collection: [4, Geeks, To, TreeSet, Welcome] New Collection: [To, Welcome]
Collection: [Welcome, To, Geeks, 4, Geeks, LinkedList] New Collection: [Welcome, To, Geeks]
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.