Hello Friends,
In this tutorial, we will see how we can sort a list of items when few of the items are null in the list using Java 8 Comparator.nullsFirst, such that nulls are treated as smallest elements in the list.
- What is Comparator
- What is nullsFirst method doing in Comparator
- Sorting a list of Strings having non null names
- Sorting a list of Strings having names and Nulls without using nullsFirst
- Solving above problem by sorting the list using nullsFirst method
- Sorting a list of Custom objects without nulls
- Sorting a list of Custom objects with nulls without using nullsFirst
- Solving above problem by sorting the list using nullsFirst method
- Sorting the list having employee with name as null
In this tutorial, we will see how we can sort a list of items when few of the items are null in the list using Java 8 Comparator.nullsFirst, such that nulls are treated as smallest elements in the list.
- What is Comparator
- What is nullsFirst method doing in Comparator
- Sorting a list of Strings having non null names
- Sorting a list of Strings having names and Nulls without using nullsFirst
- Solving above problem by sorting the list using nullsFirst method
- Sorting a list of Custom objects without nulls
- Sorting a list of Custom objects with nulls without using nullsFirst
- Solving above problem by sorting the list using nullsFirst method
- Sorting the list having employee with name as null