Copies an iterable's elements into an array. @param iterable the iterable to copy @param type the type of the elements @return a newly-allocated array into which all the elements of the iterable have been copied
(Iterable<? extends T> iterable, Class<T> type)
| 334 | */ |
| 335 | |
| 336 | @GwtIncompatible // Array.newInstance(Class, int) |
| 337 | public static <T> T[] toArray(Iterable<? extends T> iterable, Class<T> type) { |
| 338 | return toArray(iterable, ObjectArrays.newArray(type, 0)); |
| 339 | } |
| 340 | |
| 341 | static <T> T[] toArray(Iterable<? extends T> iterable, T[] array) { |
| 342 | Collection<? extends T> collection = castOrCopyToCollection(iterable); |
no test coverage detected