Java examples for java.util:Iterable Convert
Create new Array List from Iterable<E>
//package com.java2s; import java.util.ArrayList; import java.util.Iterator; public class Main { public static <E> ArrayList<E> newArrayList(Iterable<E> iterable) { if (iterable == null) { throw new NullPointerException(); }/*from w ww . j ava 2s. c o m*/ ArrayList<E> list = new ArrayList<E>(); for (Iterator<E> i = iterable.iterator(); i.hasNext();) { list.add(i.next()); } return list; } }