Depending on whether you need to be able to "add/remove" from the
Objects list after its set:
public void setObjects(List objects) {
this.objects = objects == null ? Collections.emptyList() : objects;
}
// or
public void setObjects(List objects) {
this.objects = objects == null ? new Arra
Maybe instead of throwing exception creating empty list would work for you
(I often use it to avoid routine null checks )
public void setObjects(List objects){
if (objects == null)
{
objects = new ArrayLis();
}
this.objects = objects;
}