I want to check if all the fields of an object is null or not using Java 8. Tried different approach as mentioned in here but I want it to be done using Java 8 feature.
For example:
class person{
String name;
Long id;
//getter & setter
}
Person person = new Person();
List<Person> personList = new ArrayList<>();
personList.add(person);
I want to add person to list only when id and name is not NULL. Since, Person has more than 10 fields, I dont want to null check each field and add to list. Here, I am setting those fields from ResultSet from DB operation.