Create Java ArrayList From Enumeration
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
public class Main {
public static void main(String[] args) {
Vector<String> v = new Vector<String>();
v.add("A");
v.add("B");
v.add("D");
v.add("E");
v.add("F");
System.out.println(v);
Enumeration e = v.elements();
ArrayList<String> aList = Collections.list(e);
System.out.println(aList);
}
}
/*
[A, B, D, E, F]
[A, B, D, E, F]
*/
Related examples in the same category