Export (0) Print
Expand All

ArrayList.isEmpty Method

Visual Studio 2005

Determines whether a ArrayList object is empty.

Package: java.util

Assembly: vjslib (in vjslib.dll)


public boolean isEmpty();

Returns true if a ArrayList object contains no elements; false otherwise.

The following example shows how to determine if an ArrayList is empty.

// arraylist_isempty.jsl

import java.util.*;

public class Program
{
    public static void main(String[] args)
    {
        // Create an empty ArrayList.
        ArrayList arrList = new ArrayList();

        if (arrList.isEmpty())
        {
            System.out.println("The ArrayList is empty");
        }
        else
        {
            // Do something useful with the ArrayList.
        }
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft