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)
| 361 | */ |
| 362 | |
| 363 | @GwtIncompatible // Array.newInstance(Class, int) |
| 364 | public static <T> T[] toArray(Iterator<? extends T> iterator, Class<T> type) { |
| 365 | List<T> list = Lists.newArrayList(iterator); |
| 366 | return Iterables.toArray(list, type); |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * Adds all elements in {@code iterator} to {@code collection}. The iterator |
nothing calls this directly
no test coverage detected