Showing posts with label TreeMap. Show all posts
Showing posts with label TreeMap. Show all posts

Difference between Hashtable, HashMap, TreeMap and LinkedHashMap

Map is one of the most important data structures and when we talk about Map all these 4 implementation classes (Hashtable, HashMap, TreeMap and LinkedHashMap) are most used. Hashtable, HashMap and LinkedHashMap are directly...

Sorting duplicate elements in single array

There are lot of sorting algorithms like bubble sort, quick sort, insertion sort, rad-ix sort etc., But all these sorting algorithm gives array of elements in an ascending or descending order.  In point of...

TreeMap using custom object sorting

We know that by default TreeMap will sort the values using key. Suppose if we need to sort the TreeMap using object stored in key part then we need to implement the Comparator interface...

Using Java TreeMap

Today we will see about one of the important interface in Java called Map interface. Map interface and derived classes are in java.util.Map package and Map uses simple data structure that contains Key and...