how to check if the list is not empty in java code example Example: how to check if a list is empty java if (list != null && !list.isEmpty()) { do something }