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

Using Lambda Expression to foreach a List object in Java

In this tutorial, I will show you all how using Lambda Expression to foreach a List object in Java. OK, let’s get started! Usually from Java 7 and earlier, whenever you want to print out elements in a List object, for example:

We usually… Read More

Using properties in Spring with @Value annotation

In this tutorial, I would like to introduce to you all how to use properties in Spring with @Value annotation. First of all, we need a Maven project for example: I will use Java 17 for this example:

Spring framework dependency:

HelloWorld class:… Read More