filmov
tv
Learn Java Programming - ArrayList removeAll Method Tutorial

Показать описание
The removeAll method removes all matching elements in the current ArrayList instance that match all elements from the derived Collection list argument. The Collection portion of the parameter list means that we can pass in any object that is a subclass or subinterface of the Collection interface. The Collection interface lays the ground work for the Collection Framework. The Collection interface defines many essential abstract methods such as add(), clear(), remove(), and of course removeAll(). Each and every subclass or subinterface will inherit these methods and any concrete subclass must implement them. So now we know that a collection must contain a group of elements (objects) and hence why we can pass an object instance that is derived from the Collection interface.
Now the chevron?chevron portion of the parameter list is a generic wildcard of unknown type. I will be going over generic wildcards and wildcard bounding in future tutorials after I have completed my ArrayList series. For now, just be sure that the object types contained in the elements of the current instance of the ArrayList match the object types contained in the Collection list argument object.
The c portion of the parameter list merely represents a local copy of the reference variable.
Now the chevron?chevron portion of the parameter list is a generic wildcard of unknown type. I will be going over generic wildcards and wildcard bounding in future tutorials after I have completed my ArrayList series. For now, just be sure that the object types contained in the elements of the current instance of the ArrayList match the object types contained in the Collection list argument object.
The c portion of the parameter list merely represents a local copy of the reference variable.