Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; public class Main { public static List toList(final Iterator iterator) { List list = new ArrayList(); while (iterator.hasNext()) { list.add(iterator.next()); } return list; } public static List toList(final Object[] objects) { List list = new ArrayList(); for (int i = 0; i < objects.length; i++) { Object object = objects[i]; list.add(object); } return list; } public static List toList(Enumeration e) { List list = new ArrayList(); while (e.hasMoreElements()) { list.add(e.nextElement()); } return list; } }