import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Integer[] numbers = { 7, 7, 8, 9, 10, 8, 8, 9, 6, 5, 4 };
List<Integer> list = Arrays.asList(numbers);
Set<Integer> set = new HashSet<Integer>(list);
for (Iterator iterator = set.iterator(); iterator.hasNext();) {
Object o = iterator.next();
System.out.print(o + ", ");
}
}
}
|