import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeSet;
public class TreeSetExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
TreeSet<String> name=new TreeSet<>();
name.add("Dx");
name.add("Ravi");
name.add("mitul");
name.add("Dhaval");
name.add("Bittu");
Iterator<String> it=name.iterator();
while(it.hasNext())
{
System.out.println(it.next());
}
}
}
import java.util.Iterator;
import java.util.TreeSet;
public class TreeSetExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
TreeSet<String> name=new TreeSet<>();
name.add("Dx");
name.add("Ravi");
name.add("mitul");
name.add("Dhaval");
name.add("Bittu");
Iterator<String> it=name.iterator();
while(it.hasNext())
{
System.out.println(it.next());
}
}
}
No comments:
Post a Comment