import java.util.*;
public class setiterator {
public static void main(String[] args) {
Set s = new TreeSet();
s.add(1000);
s.add(400);
s.add(900);
s.add(700);
s.add(400);
Iterator it = s.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
}
}
Output
400 700 900 1000If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.