Eliminate items from a list that are not part of a specified collection.
import public
|
The retainAll() method removes all items from a list that are not contained in a specified collection.
Syntax
public boolean retainAll(Collection items) |
Parameter Values
Parameter |
Description |
Items |
Mandatory: A collection containing the items to retain in the list, removing all others. |
Technical Details
Returns: |
True if the list was altered; otherwise, false. |
Throws: |
NullPointerException occurs if the collection is null. |