Java Utililty Methods Iterable to Collection

List of utility methods to do Iterable to Collection

Description

The list of methods to do Iterable to Collection are organized into topic(s).

Method

voiditerableToCollection(Iterable iter, Collection list)
iterable To Collection
if (iter == null) {
    return;
for (E element : iter) {
    list.add(element);
CollectioniterableToCollection(Iterable iterable)
iterable To Collection
Collection<T> collection = new ArrayList<>();
iterable.forEach(collection::add);
return collection;
StringiterableToString(Iterable collection, String sep)
iterable To String
StringBuilder bld = new StringBuilder();
Iterator<?> it = collection.iterator();
while (it.hasNext()) {
    bld.append(it.next());
    if (it.hasNext()) {
        bld.append(sep);
return bld.toString();
StringiterableToString(String separator, Iterable collection)
iterable To String
if (collection != null)
    return iterableToString(separator, collection.iterator());
return "";