提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
通过ArrayList获取枚举
import java.util.ArrayList; /* from 时 代 J a v a - nowjava.com */ import java.util.Collections; import java.util.Enumeration; public class Main { public static void main(String[] args) { ArrayList arrayList = new ArrayList(); arrayList.add("A"); arrayList.add("B"); arrayList.add("D"); arrayList.add("E"); arrayList.add("F"); Enumeration e = Collections.enumeration(arrayList); System.out.println("Enumerating through Java ArrayList"); /* 时 代 J