...

/

TreeMap: Creation and Insertion

TreeMap: Creation and Insertion

Let's look at the creation and insertion of TreeMap.

TreeMap is a class in the java.utils package that stores the keys in sorted order. Some of the features of TreeMap are:

  1. The entries in TreeMap are sorted in the natural ordering of its keys.

  2. It does not allow null keys, however there can be null values.

  3. The TreeMap is not thread-safe, although it can be made thread-safe using the synchronizedMap() method of the Collections class.

Since a ...