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

Method remove

lib/java/util/AbstractCollection.java:225–243  ·  view source on GitHub ↗

Removes one instance of the specified object from this Collection if one is contained (optional). This implementation iterates over this Collection and tests for each element e returned by the iterator, whether e is equal to the given object. If object != null

(Object object)

Source from the content-addressed store, hash-verified

223 * doesn't support {@code null} elements.
224 */
225 public boolean remove(Object object) {
226 Iterator<?> it = iterator();
227 if (object != null) {
228 while (it.hasNext()) {
229 if (object.equals(it.next())) {
230 it.remove();
231 return true;
232 }
233 }
234 } else {
235 while (it.hasNext()) {
236 if (it.next() == null) {
237 it.remove();
238 return true;
239 }
240 }
241 }
242 return false;
243 }
244
245 /**
246 * Removes all occurrences in this {@code Collection} of each object in the

Callers

nothing calls this directly

Calls 5

iteratorMethod · 0.95
hasNextMethod · 0.65
equalsMethod · 0.65
nextMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected