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

Method castOrCopyToCollection

output/java_guava/1.4.18/Iterables.java:364–368  ·  view source on GitHub ↗

Converts an iterable into a collection. If the iterable is already a collection, it is returned. Otherwise, an java.util.ArrayList is created with the contents of the iterable in the same iteration order.

(Iterable<E> iterable)

Source from the content-addressed store, hash-verified

362 */
363
364 private static <E> Collection<E> castOrCopyToCollection(Iterable<E> iterable) {
365 return (iterable instanceof Collection)
366 ? (Collection<E>) iterable
367 : Lists.newArrayList(iterable.iterator());
368 }
369
370 /**
371 * Adds all elements in {@code iterable} to {@code collection}.

Callers 1

toArrayMethod · 0.95

Calls 2

newArrayListMethod · 0.95
iteratorMethod · 0.65

Tested by

no test coverage detected