Get Enumeration over Java ArrayList in Java
Description
The following code shows how to get Enumeration over Java ArrayList.
Example
/* www . j av a 2s .c o m*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
public class Main {
public static void main(String[] args) {
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("A");
arrayList.add("B");
arrayList.add("D");
arrayList.add("E");
arrayList.add("F");
Enumeration e = Collections.enumeration(arrayList);
while (e.hasMoreElements())
System.out.println(e.nextElement());
}
}
The code above generates the following result.