Collections.list(Enumeration <T> e) has the following syntax.
public static <T> ArrayList <T> list(Enumeration <T> e)
In the following code shows how to use Collections.list(Enumeration <T> e) method.
/* w w w. j a v a2 s . c o m*/ import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Vector; public class Main { public static void main(String args[]) { // create vector and array list List<String> arrlist = new ArrayList<String>(); Vector<String> v = new Vector<String>(); // populate the vector v.add("A"); v.add("B"); v.add("C"); v.add("D"); v.add("from java2s.com"); // create enumeration Enumeration<String> e = v.elements(); // get the list arrlist = Collections.list(e); System.out.println("Value of returned list: "+arrlist); } }
The code above generates the following result.