Sunday, January 16, 2011

tailMap

  SortedMap tailMap(K fromKey);

1-It is method in the TreeMap .
2-Returns a view of the portion of this map whose keys are greater than or equal to fromKey .
3-This method returns the portion of TreeMap whose keys are grater than or equal to fromKey.

Example :
ublic static void main(String[] args) {
                TreeMap mapexample = new TreeMap();
                map.put(1, "AAA");
                map.put(2, "BBB");
                map.put(3, "CCC");
                map.put(4, "DDD");
                SortedMap smap1 = map.tailMap(3);
                System.out.println(smap1);
            }
   

OutPut:{ 3=CCC 4=DDD}