java-logo

what is the difference between comparable and comparator

In this tutorial we will learn what is the difference between comparable and comparator interfaces , and when we need to use comparable and when we need to use comparator. Basically “what is the difference between comparable and comparator ? ” is one of the Java interview question,  and in Java we have two interfaces which are using to […]

java-logo

How To Sort Hashmap By Value in Java

In real-time, you may be getting hashmap result from the server and you want to display the hashmap values in sorted order Or you may need to display the values in a drop down but in a sorted order. For example, from server we are getting different types of pizza’s with the item as key […]