Adds all elements in iterable to collection. @return true if collection was modified as a result of this operation.
(Collection<T> addTo, Iterable<? extends T> elementsToAdd)
| 356 | * operation. |
| 357 | */ |
| 358 | @CanIgnoreReturnValue |
| 359 | public static <T> boolean addAll(Collection<T> addTo, Iterable<? extends T> elementsToAdd) { |
| 360 | if (elementsToAdd instanceof Collection) { |
| 361 | Collection<? extends T> c = Collections2.cast(elementsToAdd); |
| 362 | return addTo.addAll(c); |
| 363 | } |
| 364 | return Iterators.addAll(addTo, checkNotNull(elementsToAdd).iterator()); |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * Returns the number of elements in the specified iterable that equal the |
no test coverage detected