What is Map and SortedMap interface?

What is Map and SortedMap interface?

- Map is used to store the key-Value pairs.

Map interfaces
- Map implemented by HashMap and TreeMap.
- SortedMap implemented by TreeMap.

Explain the concepts of Map and SortedMap interface.

Keys will be mapped to their values using Map object. Map allows no duplicate values. The keys in a map objects must be unique. Java collection framework allows implementing Map interface in three classes namely, HashMap, TreeMap and LinkedHashMap.

SortedMap is a special interface for maintaining all the elements in a sorted order. This interface extends Map interface. It maintains all the elements in ascending order. The sorting process is performed on the map keys. It has two additional methods than Map interface. They are firstKey() and lastKey(). Method firstKey() returns the first value available currently in the map, where as the lastKey() returns the last value available currently in the map.
Java Externalizable Interface
Explain the concepts of Externalizable Interface, Define the purpose of Externalizable Interface...
What is transient and volatile modifiers?
When serializable interface is declared, the compiler knows that the object has to be handled so as so be able to serialize it...
Java daemon threads: What are daemon threads?
Java daemon threads - Threads that work in the background to support the runtime environment are called daemon threads...
Post your comment