MCPcopy Index your code
hub / github.com/apache/groovy / retainAll

Method retainAll

src/main/java/groovy/util/ObservableSet.java:355–380  ·  view source on GitHub ↗

{@inheritDoc}

(Collection<?> c)

Source from the content-addressed store, hash-verified

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

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