Java examples for java.util:Iterable Convert
Convert Iterable to List
//package com.java2s; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Main { public static <T> List<T> toList(final Iterable<T> iterable) { final List<T> list = new ArrayList<T>(); for (Iterator<T> i = iterable.iterator(); i.hasNext();) { list.add(i.next());// ww w. jav a2 s . c om } return list; } }