2015-04-20 15:36:01 -07:00
|
|
|
|
//: containers/Enumerations.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-04-20 15:36:01 -07:00
|
|
|
|
// Java 1.0/1.1 Vector and Enumeration.
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import net.mindview.util.*;
|
|
|
|
|
|
|
|
|
|
public class Enumerations {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
Vector<String> v =
|
2015-05-05 11:20:13 -07:00
|
|
|
|
new Vector<>(Countries.names(10));
|
2015-04-20 15:36:01 -07:00
|
|
|
|
Enumeration<String> e = v.elements();
|
|
|
|
|
while(e.hasMoreElements())
|
|
|
|
|
System.out.print(e.nextElement() + ", ");
|
|
|
|
|
// Produce an Enumeration from a Collection:
|
2015-05-05 11:20:13 -07:00
|
|
|
|
e = Collections.enumeration(new ArrayList<>());
|
2015-04-20 15:36:01 -07:00
|
|
|
|
}
|
|
|
|
|
} /* Output:
|
2015-05-05 11:20:13 -07:00
|
|
|
|
ALGERIA, ANGOLA, BENIN, BOTSWANA, BURKINA FASO, BURUNDI, CAMEROON, CAPE VERDE, CENTRAL AFRICAN REPUBLIC, CHAD,
|
2015-04-20 15:36:01 -07:00
|
|
|
|
*///:~
|