Java List.isEmpty()
Syntax
List.isEmpty() has the following syntax.
boolean isEmpty()
Example
In the following code shows how to use List.isEmpty() method.
// w w w . j a v a 2s. c o m
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] a) {
List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
System.out.println(list.size());
System.out.println(list.isEmpty());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »