Converts an iterable into a collection. If the iterable is already a collection, it is returned. Otherwise, an java.util.ArrayList is created with the contents of the iterable in the same iteration order.
(Iterable<E> iterable)
| 362 | */ |
| 363 | |
| 364 | private static <E> Collection<E> castOrCopyToCollection(Iterable<E> iterable) { |
| 365 | return (iterable instanceof Collection) |
| 366 | ? (Collection<E>) iterable |
| 367 | : Lists.newArrayList(iterable.iterator()); |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Adds all elements in {@code iterable} to {@code collection}. |
no test coverage detected