@Test public void iterableToList() { Iterable<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); List<Integer> list = Iterables.toList(numbers); assertThat(list).hasSize(5).containsAll(numbers); }
@Nonnull public static <T> List<T> toList(@Nonnull final Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { List<T> list = new ArrayList<>(); for (T item : iterable) { list.add(item); } return list; } }
Iterables { @Nonnull public static <T> List<T> toList(@Nonnull final Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { List<T> list = new ArrayList<>(); for (T item : iterable) { list.add(item); } return list; } } }
Iterables { @Nonnull public static <T> List<T> toList(@Nonnull final Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { List<T> list = new ArrayList<>(); for (T item : iterable) { list.add(item); } return list; } }  }
Iterables { @Nonnull public static <T> List<T> toList(@Nonnull final Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { List<T> list = new ArrayList<>(); for (T item : iterable) { list.add(item); } return list; } }  @Nonnull static List<T> toList(@Nonnull final Iterable<T> iterable); @Nonnull static Set<T> toSet(@Nonnull Iterable<T> source); }
Iterables { @Nonnull public static <T> List<T> toList(@Nonnull final Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { List<T> list = new ArrayList<>(); for (T item : iterable) { list.add(item); } return list; } }  @Nonnull static List<T> toList(@Nonnull final Iterable<T> iterable); @Nonnull static Set<T> toSet(@Nonnull Iterable<T> source);  }