The Sorted Map Interface ,

The"SortedMap interface extends Map. It ensures that the entries are maintained in ascending key order. The methods declared by SortedMap are summarized in . several methods throw a NoSuchElementException when no items are in the invoking map. A ClassCastException is thrown when an object is incompatible withthe elements in a map. A NullPointerExceptibn is thrown if an attempt is made to use a null object when null is 110t allowed in the map.

 Sorted maps allow very efficient manipulations of subrnaps (in other words, Q subset of a map), To obtain i) subrnnp, use headMap( ), tailMap(), or subMap( ). To get the first key in the set, call firstKcy(). To get the last key, use lastKey( ).

The Map Entry Interface 

The Map.Entry interface enables you to work with a map entry. Recall that theentrySet( ) method declared by the Map interface returns a Set containing the map entries. Each of these set elements is a Map.Entry object. Table 15-8 summarizes the methods declared by this interface

Share This