Accounting Basics Tutorial


Java Collections TreeSet

TreeSet  : TreeSet class provides an implement of the set interface that uses a tree of storage. Objects are stored in sortedm ascending order, acces and retrieval times are quite fast whch makes treeset an excellent choice when storing large amounts of sorted information that must be found quickly.

WRITE A PROGRAM ON TREESET CLASS.

import java.util.*;
class Sample
{
        public static void main(String args[])
        {
                TreeSet <String>ts=new TreeSet<String>();
                ts.add("B");
                ts.add("A");
                ts.add("C");
                System.out.println(ts);
        }
}



google ads place