Copies an iterator's elements into an array. The iterator will be left exhausted: its hasNext() method will return false. @param iterator the iterator to copy @param type the type of the elements @return a newly-allocated array into which all the elements of the iterator hav
(Iterator<? extends T> iterator, Class<T> type)
| 348 | * have been copied |
| 349 | */ |
| 350 | @GwtIncompatible // Array.newInstance(Class, int) |
| 351 | public static <T> T[] toArray(Iterator<? extends T> iterator, Class<T> type) { |
| 352 | List<T> list = Lists.newArrayList(iterator); |
| 353 | return Iterables.toArray(list, type); |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Adds all elements in {@code iterator} to {@code collection}. The iterator |
nothing calls this directly
no test coverage detected