The “Collections” framework in Java came into action with the release of JDK 1.2 and was expanded quite a few times in Java 1.4 and Java 5 and then again in Java 6.
Continue readingtreemap
Java TreeMap Example
TreeMap implements the Map interface and also NavigableMap along with the Abstract Class. The map is sorted according to the natural ordering of its keys or by a Comparator provided a the time of initialization. In terms of time complexity, this implementation provides log(n) cost for the containsKey, get, put and remove operations. It’s important…
Continue readingJava SortedMap Example
SortedMap interface extends Map and ensures that all entries are in an ascending key order (hence SortedMap). If you want to have it in a descending order, you will need to override the Compare method in the SortedMap which we will do shortly. TreeMap implements SortedMap and it either orders the keys by their natural…
Continue readingDifference between HashMap and TreeMap in Java
In this article I will explain the difference between java HashMap and java TreeMap
Continue reading