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

Convert char to String in Java

In this tutorial, I will show you all how to convert char to String in Java. Let consider the following example:

To convert this character “K” to String, we will use the Character object with method toString() as below:

Result: