List of utility methods to do Iterable to Collection
void | iterableToCollection(Iterable extends E> iter, Collection iterable To Collection if (iter == null) { return; for (E element : iter) { list.add(element); |
Collection | iterableToCollection(Iterable iterable To Collection Collection<T> collection = new ArrayList<>(); iterable.forEach(collection::add); return collection; |
String | iterableToString(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(); |
String | iterableToString(String separator, Iterable iterable To String if (collection != null) return iterableToString(separator, collection.iterator()); return ""; |