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

Method removeAll

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

{@inheritDoc}

(Collection c)

Source from the content-addressed store, hash-verified

345
346 /** {@inheritDoc} */
347 @Override
348 public boolean removeAll(Collection c) {
349 if (c == null) {
350 return false;
351 }
352
353 List values = new ArrayList();
354 // GROOVY-7783 use Sets for O(1) performance for contains
355 Set delegateSet = new HashSet<Object>(delegate);
356 if (!(c instanceof Set)) {
357 c = new HashSet<Object>(c);
358 }
359 for (Object element : c) {
360 if (delegateSet.contains(element)) {
361 values.add(element);
362 }
363 }
364
365 int oldSize = size();
366 boolean success = delegate.removeAll(c);
367 if (success && !values.isEmpty()) {
368 fireMultiElementRemovedEvent(values);
369 fireSizeChangedEvent(oldSize, size());
370 }
371
372 return success;
373 }
374
375 /** {@inheritDoc} */
376 @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