Wednesday, 18 January 2017

TreeSet : LastMethod





import java.util.TreeSet;

public class LastMethod {

    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);
        ts1.add(24);
        ts1.add(12);
       
        System.out.println("Full-List (Duplicate Not Allowed && Maintain Ascending Order in TreeSet) : "+ts1);
       
        System.out.println("Last method, get Highest last element "+ts1.last());
    }
}

No comments:

Post a Comment