firstEntry() method

firstEntry(): It returns the key-value pair having the least key (Key having lowest value). It returns the pair that associated with least key. It returns null if TreeMap is empty. Output: Pair of least Key :1=A

replace(K key, V oldValue, V newValue) method

replace(K key, V oldValue, V newValue): This method is used to replace the entry for the specified key only if it is currently mapped to some value. If oldValue doesn’t match with associated key then it does not replace the value. Its return type is boolean. Where, Key is the key with which the specified … Read more

descendingMap() method

descendingMap(): It returns a NavigableSet view of the Key-Value(pairs) in reverse order. This method is used to fetch the Set view of all pairs(keys-values) in reverse order. It returns all the keys and values in form of NavigableSet. This Set worked on backed of TreeMap, if any change makes in TreeMap also reflects in this … Read more

replace(K key, V value) method

replace(K key, V value): This replace string Javascript method is used to replace the entry for the specified key only if it is currently mapped to some value in java. Where, Key is the key with which the specified value(V) is to be associated in TreeMap.Value is the value to be associated with the specified … Read more

descendingKeySet() method

descending KeySet in Java: This descendingKeySet() method is used to fetch the Set view of all keys in reverse order. It returns all the key in form of NavigableSet. This Set worked on backed of TreeMap, if any change makes in TreeMap also reflects in this Set and vice versa. It returns type is Set. … Read more

keySet() method

keySet(): This method is used to fetch the Set view of all keys. It returns all the key set. This Set worked on backed of TreeMap, if any change makes in TreeMap also reflects in this Set and vice versa. So, this keySet in Java returns type is Set. Where, K represents the type keys … Read more

entrySet() method

entrySet(): This entrySet method in Java is used to fetch the Set view of all keys and Values. It returns all the key and values in form of Set. This Set worked on backed of TreeMap, if any change makes in TreeMap also reflects in this Set and vice versa. It returns type is Set. … Read more

clear() method

clear(): This clear javascript method is used to remove all the elements from the TreeMap in Java. Its return type is void. It means this method doesn’t returns anything. Output: Name from list = JAVA Name from list = GOAL Name from list = RAVI Name from list = SITE After Clear() method list is … Read more

size() method

size(): This size string javascript method in java returns the number of elements in TreeMap. Its return type is int. Output: Size of list = 3

clone() method

clone() method: The clone object javascript method of TreeSet class is used to return a shallow copy of the specified TreeSet in Java. Its return type is Object. It returns the object of Object class. Output: Names from list = JAVANames from list = GOALNames from list = RAVINames from clones list = JAVANames from … Read more