how to check if a list is empty java

Java
if (list != null && !list.isEmpty()) { do something }
Source

Also in Java: