Check out example codes for "validation list empty java". It will help you in understanding the concepts better.

Code Example 1

public class ArrayListExample 
{
    public static void main(String[] args) 
    {
        ArrayList<String> list = new ArrayList<>();
         
        System.out.println(list.isEmpty());     //true
         
        list.add("A");
         
        System.out.println(list.isEmpty());     //false
         
        list.clear();
         
        System.out.println(list.isEmpty());     //true
    }
}

Learn ReactJs, React Native from akashmittal.com