Iterator out of Vector
import java.util.Iterator;
import java.util.Vector;
public class Main {
public static void main(String[] arguments) {
String[] codes = { "alpha", "lambda", "gamma", "delta", "zeta" };
Vector list = new Vector();
for (int i = 0; i < codes.length; i++) {
if (!list.contains(codes[i])) {
list.add(codes[i]);
}
}
for (Iterator ite = list.iterator(); ite.hasNext();) {
String output = (String) ite.next();
System.out.println(output);
}
}
}
Related examples in the same category