Showing posts with label Comparator. Show all posts
Showing posts with label Comparator. Show all posts

Difference between Comparator and Comparable interface in Java

Comparator and Comparable are two interfaces which used to implement Object sorting in Java. It used to sort Objects stored in any Collection classes like HashMap, HashTable, ArrayList etc., Whenever we implement 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...

Object sorting using Comparator and Comparable Interface in Java

Today we will discuss about how to sort Object using Comparator and Comparable interface in Java.         How to sort Object using Comparator and Comparable Interface in Java is a frequent question in...