MCPcopy Create free account
hub / github.com/davidgiven/luje / removeAll

Method removeAll

lib/java/util/AbstractSet.java:97–115  ·  view source on GitHub ↗

Removes all occurrences in this collection which are contained in the specified collection. @param collection the collection of objects to remove. @return true if this collection was modified, false otherwise. @throws UnsupportedOperationException i

(Collection<?> collection)

Source from the content-addressed store, hash-verified

95 * if removing from this collection is not supported.
96 */
97 @Override
98 public boolean removeAll(Collection<?> collection) {
99 boolean result = false;
100 if (size() <= collection.size()) {
101 Iterator<?> it = iterator();
102 while (it.hasNext()) {
103 if (collection.contains(it.next())) {
104 it.remove();
105 result = true;
106 }
107 }
108 } else {
109 Iterator<?> it = collection.iterator();
110 while (it.hasNext()) {
111 result = remove(it.next()) || result;
112 }
113 }
114 return result;
115 }
116}

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
containsMethod · 0.65
nextMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected