MCPcopy Create free account
hub / github.com/apache/groovy / retainAll

Method retainAll

src/main/java/groovy/util/ObservableList.java:376–401  ·  view source on GitHub ↗

{@inheritDoc}

(Collection c)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.95
fireSizeChangedEventMethod · 0.95
addMethod · 0.65
containsMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected