Friday, 20 January 2017

TreeMap : LastMethod


import java.util.TreeMap;

public class LastMethod {

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


        TreeMap<Integer, Integer> lhm1 = new TreeMap<>();
        lhm1.put(10, 1);
        lhm1.put(20, 2);
        lhm1.put(30, 3);
        lhm1.put(40, 4);
        lhm1.put(50, 5);
       
       
       
        System.out.println("Full-List : "+lhm1);
               
        System.out.println("lastKey() : "+ lhm1.lastKey());
        System.out.println("lastEntry() : "+lhm1.lastEntry());
    }
}

No comments:

Post a Comment