I was refactoring some old code of mine that I\'ve written and I stumbeled on this code:
List fullImagePool = new ArrayList<>();
This refactors cleanly to
for (OcmImageData elem : new List[] { style.getTestMH(), style.getTrousers() /* etc */}) {
if (CollectionUtils.isNotEmpty(elem)) {
fullImagePull.addAll(elem);
}
}
To answer your original question, no, you will have to do your own null check. You can see Guava's methods will throw an NPE, and Apache's methods explicitly require the input to be not null.