![]() |
VOOZH | about |
TreeMap firstEntry() refers to the method used to retrieve the key-value pairs mapped with the lowest key value element that exists in the TreeMap, if there are no key-value pairs within the Map, simply returns null. The method name 'firstEntry()' explains itself that it will return entry having the least key element with its value.
Syntax: public Map.Entry<K,V> firstEntry(), Here K and V refer key-value respectively. Parameters: NA - As it doesnot accept any parameter. Return Value: It returns an entry with the least key (lowest key-value pair) and null if the TreeMap is empty. Exception: NA - As it doesnot throw any exception at entry return.
Lowest Entry is: 1=Python
By the above example, it's clear that firstEntry() checks compare each key of TreeMap, and returns having the least key-value pair.
Lowest Entry is: 65.5=Gulshan
Some points on TreeMap firstEntry():