Removes all occurrences in this Collection of each object in the specified Collection (optional). After this method returns none of the elements in the passed Collection can be found in this Collection anymore. This implementation iterates over this {@code Collect
(Collection<?> collection)
| 272 | * if {@code collection} is {@code null}. |
| 273 | */ |
| 274 | public boolean removeAll(Collection<?> collection) { |
| 275 | boolean result = false; |
| 276 | Iterator<?> it = iterator(); |
| 277 | while (it.hasNext()) { |
| 278 | if (collection.contains(it.next())) { |
| 279 | it.remove(); |
| 280 | result = true; |
| 281 | } |
| 282 | } |
| 283 | return result; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Removes all objects from this {@code Collection} that are not also found in the |