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)
| 362 | * operation |
| 363 | */ |
| 364 | @CanIgnoreReturnValue |
| 365 | public static <T> boolean addAll(Collection<T> addTo, Iterator<? extends T> iterator) { |
| 366 | checkNotNull(addTo); |
| 367 | checkNotNull(iterator); |
| 368 | boolean wasModified = false; |
| 369 | while (iterator.hasNext()) { |
| 370 | wasModified |= addTo.add(iterator.next()); |
| 371 | } |
| 372 | return wasModified; |
| 373 | } |
| 374 | |
| 375 | /** |
| 376 | * Returns the number of elements in the specified iterator that equal the |
no test coverage detected