How do you check if an ArrayList is empty?
Answer
To check if an ArrayList is empty, you can use
ArrayList.isEmpty() method or first check if the ArrayList is null, and if not null, check its size using ArrayList. size() method. The size of an empty ArrayList is zero.