Sort a Map using Stream and Collectors in Java

In this tutorial, I will show you how to order elements in a Map object using the Stream object and the Collectors object in Java by key and by value. For example, we have a Map object like this:

Prior to Java 8, to… Read More

Using Lambda Expression to sort a List in Java

Normally, before Java 8, when we want to sort a List object, we will use Comparator object. For example:

Result: Since Java 8, we have another way to do the sorting a List object. That is: using sort() method in List object with Lambda… Read More