MCPcopy
hub / github.com/google/guava / toArray

Method toArray

guava/src/com/google/common/collect/Iterables.java:288–292  ·  view source on GitHub ↗

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<@NonNull T> type)

Source from the content-addressed store, hash-verified

286 * @return a newly-allocated array into which all the elements of the iterable have been copied
287 */
288 @GwtIncompatible // Array.newInstance(Class, int)
289 public static <T extends @Nullable Object> T[] toArray(
290 Iterable<? extends T> iterable, Class<@NonNull T> type) {
291 return toArray(iterable, ObjectArrays.newArray(type, 0));
292 }
293
294 static <T extends @Nullable Object> T[] toArray(Iterable<? extends T> iterable, T[] array) {
295 Collection<? extends T> collection = castOrCopyToCollection(iterable);

Callers 15

toArrayMethod · 0.95
CompoundOrderingMethod · 0.95
sortedCopyMethod · 0.95
copyOfMethod · 0.95
toArrayMethod · 0.95
copyOfMethod · 0.95
fromEntriesMethod · 0.95
copyOfMethod · 0.95
sortedCopyOfMethod · 0.95
testToArrayEmptyMethod · 0.95
testToArraySingletonMethod · 0.95
testToArrayMethod · 0.95

Calls 2

newArrayMethod · 0.95

Tested by 4

testToArrayEmptyMethod · 0.76
testToArraySingletonMethod · 0.76
testToArrayMethod · 0.76
createListMethod · 0.76