Archive
Archive for January, 2011
Collection To Enumeration
January 7, 2011
Leave a comment
List<String> list = new ArrayList<String>();
for (int i = 0; i < 5; i++) {
list.add(i + "");
}
System.out.println("use for() loop");</pre>
for (String value : list) {
System.out.println(value);
}
Enumeration<String> enumeredList = Collections.enumeration(list);
System.out.println("use while() loop"); while (enumeredList.hasMoreElements()) {
System.out.println(enumeredList.nextElement());
}
Categories: JAVA
Hello world!
January 7, 2011
1 comment
Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!
Categories: Uncategorized