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)
| 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 |
no test coverage detected