I've a List
of domain class where the domain class variables are null and the List
returns 1 object. Can anyone help me validate the List
for null
. isEmpty
dosn't seem to work.
Code
public static void main(String[] args) {
DomainClass1 d = new DomainClass1();
List<DomainClass1> domain = new ArrayList<>();
d.setTest1(null);
d.setTest2(null);
d.setTest3(null);
d.setTest4(null);
domain.add(d);
System.out.println(domain);
if (domain.isEmpty()) {
System.out.println("is empty");
}
}