{@inheritDoc}
(Collection<?> c)
| 353 | |
| 354 | /** {@inheritDoc} */ |
| 355 | @Override |
| 356 | public boolean retainAll(Collection<?> c) { |
| 357 | if (c == null) { |
| 358 | return false; |
| 359 | } |
| 360 | |
| 361 | List values = new ArrayList(); |
| 362 | // GROOVY-7822 use Set for O(1) performance for contains |
| 363 | if (!(c instanceof Set)) { |
| 364 | c = new HashSet<Object>(c); |
| 365 | } |
| 366 | for (Object element : delegate) { |
| 367 | if (!c.contains(element)) { |
| 368 | values.add(element); |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | int oldSize = size(); |
| 373 | boolean success = delegate.retainAll(c); |
| 374 | if (success && !values.isEmpty()) { |
| 375 | fireMultiElementRemovedEvent(values); |
| 376 | fireSizeChangedEvent(oldSize, size()); |
| 377 | } |
| 378 | |
| 379 | return success; |
| 380 | } |
| 381 | |
| 382 | /** {@inheritDoc} */ |
| 383 | @Override |
nothing calls this directly
no test coverage detected