Copies all the elements from this fluent iterable to collection. This is equivalent to calling Iterables.addAll(collection, this). Stream equivalent: stream.forEachOrdered(collection::add) or stream.forEach(collection::add). @param collection the c
(C collection)
| 818 | */ |
| 819 | |
| 820 | @CanIgnoreReturnValue |
| 821 | public final <C extends Collection<? super E>> C copyInto(C collection) { |
| 822 | checkNotNull(collection); |
| 823 | if (iterable instanceof Collection) { |
| 824 | collection.addAll(Collections2.cast(iterable)); |
| 825 | } else { |
| 826 | for (E item : iterable) { |
| 827 | collection.add(item); |
| 828 | } |
| 829 | } |
| 830 | return collection; |
| 831 | } |
| 832 | |
| 833 | /** |
| 834 | * Returns a {@link String} containing all of the elements of this fluent iterable joined with |
nothing calls this directly
no test coverage detected