MCPcopy Create free account
hub / github.com/antlr/codebuff / toArray

Method toArray

corpus/java/training/guava/collect/Iterators.java:350–354  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

newArrayListMethod · 0.95
toArrayMethod · 0.95

Tested by

no test coverage detected