Adds all elements in iterator to collection. The iterator will be left exhausted: its hasNext() method will return false. @return true if collection was modified as a result of this operation
(Collection<T> addTo, Iterator<? extends T> iterator)
| 376 | */ |
| 377 | |
| 378 | @CanIgnoreReturnValue |
| 379 | public static <T> boolean addAll(Collection<T> addTo, Iterator<? extends T> iterator) { |
| 380 | checkNotNull(addTo); |
| 381 | checkNotNull(iterator); |
| 382 | boolean wasModified = false; |
| 383 | while (iterator.hasNext()) { |
| 384 | wasModified |= addTo.add(iterator.next()); |
| 385 | } |
| 386 | return wasModified; |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * Returns the number of elements in the specified iterator that equal the |
no test coverage detected