Java examples for java.util:List Convert
Convert Iterator to List
//package com.book2s; import java.util.*; public class Main { public static void main(String[] argv) { Iterator ite = java.util.Arrays.asList("asdf", "book2s.com") .iterator();// www . j av a 2s .c om System.out.println(list(ite)); } public static List list(Iterator ite) { ArrayList ret = new ArrayList(); while (ite.hasNext()) { Object o = ite.next(); ret.add(o); } return ret; } }