Removes all elements from this Collection, leaving it empty (optional). This implementation iterates over this Collection and calls the remove method on each element. If the iterator does not support removal of elements, an UnsupportedOperationException is thrown.
()
| 98 | * @see #size |
| 99 | */ |
| 100 | public void clear() { |
| 101 | Iterator<E> it = iterator(); |
| 102 | while (it.hasNext()) { |
| 103 | it.next(); |
| 104 | it.remove(); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Tests whether this {@code Collection} contains the specified object. This |