Does java.util.List.isEmpty()
check if the list itself is null
, or do I have to do this check myself?
For example:
List<String> test = null;
if (!test.isEmpty()) {
for (String o : test) {
// do stuff here
}
}
Will this throw a NullPointerException
because test is null
?