The difference between null and isEmpty.
Mohammad Ashrafuddin Ferdousi
posted 6 years ago
One tests if the ArrayList variable is null, the other if the ArrayList object holds any items in its list. You would test for null first, and then if not null, check if its empty or not. The reason to do it in this order is if you test if its empty and it happens to be null, you'll throw a NullPointerException for trying to call a method on a null object.
author & internet detective