Not showing null elements JAVA [How to Solve]

Reason:
the list set allows null values. When you add null values to the list, you will report an error after a series of processing

Not showing null elements

Solution:

list.removeAll(Collections.singleton(null));

Before you need to process the list, just use this code
removeAll is to remove all elements in brackets. If the parameter in brackets is empty, it means to remove all elements

Read More: