Google Guava Comparators

Google Guava library has a class called Comparators, which provides static methods for working with Java Comparator instances.

September 20, 2021

Comparator naturalOrder, reverseOrder and reversed

As a follow up of the Comparator comparing post, here we will learn about the Comparator naturalOrder, reverseOrder and reversed methods.

July 26, 2021

Comparator nullsFirst and nullsLast

Comparator nullsFirst and nullsLast methods returns a null-friendly comparator. It considers null to be less than or greater than any non-null value.

July 27, 2020

Three Ways to Sort a List in Java

In this blog post, we will see three ways to sort a list in Java. We will see how to sort in ascending and in reversed order.

October 13, 2019

Comparator comparing

The Comparator is a comparison function in Java that imposes a total ordering on a collection of objects. The comparing is a static method in it

April 29, 2019