ittimepass.com
Write a program in java to demonstrate TreeSet? ⋆ IT TIME PASS
import java.util.*; public class ListTreeSet { public static void main(String arg[]) { TreeSet ListTreeSet=new TreeSet(); System.out.println("Adding Kundan First Time "+ListTreeSet.add("Kundan")); ListTreeSet.add("Suraj"); ListTreeSet.add("Manish"); ListTreeSet.add("Ankit"); System.out.println("Adding Kundan Second Time "+ListTreeSet.add("Kundan")); System.out.println("Total Number In ListTreeSet "+ListTreeSet.size()); Iterator itr=ListTreeSet.iterator(); while(itr.hasNext()) System.out.println(itr.next()); } }