{@inheritDoc}
(Collection c)
| 374 | |
| 375 | /** {@inheritDoc} */ |
| 376 | @Override |
| 377 | public boolean retainAll(Collection c) { |
| 378 | if (c == null) { |
| 379 | return false; |
| 380 | } |
| 381 | |
| 382 | List values = new ArrayList(); |
| 383 | // GROOVY-7783 use Set for O(1) performance for contains |
| 384 | if (!(c instanceof Set)) { |
| 385 | c = new HashSet<Object>(c); |
| 386 | } |
| 387 | for (Object element : delegate) { |
| 388 | if (!c.contains(element)) { |
| 389 | values.add(element); |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | int oldSize = size(); |
| 394 | boolean success = delegate.retainAll(c); |
| 395 | if (success && !values.isEmpty()) { |
| 396 | fireMultiElementRemovedEvent(values); |
| 397 | fireSizeChangedEvent(oldSize, size()); |
| 398 | } |
| 399 | |
| 400 | return success; |
| 401 | } |
| 402 | |
| 403 | /** {@inheritDoc} */ |
| 404 | @Override |
nothing calls this directly
no test coverage detected