Wednesday, 18 January 2017

TreeSet : HeadsetMethod





import java.util.TreeSet;

public class HeadsetMethod {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

       
TreeSet<Integer> ts1 = new TreeSet<>();   
       
        ts1.add(36);
        ts1.add(48);
        ts1.add(24);
        ts1.add(64);
       
        System.out.println("Full-List (Duplicate Not Allowed && Maintain Ascending Order in TreeSet) : "+ts1);
       
        System.out.println("Headset(20) "+ts1.headSet(30));
        System.out.println("Headset(40) "+ts1.headSet(40));
       
        System.out.println(" returns a view of the portion of this set whose elements are strictly less than toElement ");

    }
}

No comments:

Post a Comment