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

Method contains

lib/java/util/AbstractCollection.java:127–143  ·  view source on GitHub ↗

Tests whether this Collection contains the specified object. This implementation iterates over this Collection and tests, whether any element is equal to the given object. If object != null then object.equals(e) is called for each element e returned by the ite

(Object object)

Source from the content-addressed store, hash-verified

125 * {@code Collection} doesn't support {@code null} elements.
126 */
127 public boolean contains(Object object) {
128 Iterator<E> it = iterator();
129 if (object != null) {
130 while (it.hasNext()) {
131 if (object.equals(it.next())) {
132 return true;
133 }
134 }
135 } else {
136 while (it.hasNext()) {
137 if (it.next() == null) {
138 return true;
139 }
140 }
141 }
142 return false;
143 }
144
145 /**
146 * Tests whether this {@code Collection} contains all objects contained in the

Callers 1

containsAllMethod · 0.95

Calls 4

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

Tested by

no test coverage detected