Return | Method | Summary |
---|---|---|
boolean | isEmpty() | Returns true if this list contains no elements. |
int | size() | Returns the number of elements in this list. |
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
List list = new ArrayList();
list.add("1");
list.add("2");
list.add("3");
list.add("java2s.com");
System.out.println(list);
System.out.println(list.isEmpty());
System.out.println(list.size());
}
}
The output:
[1, 2, 3, java2s.com]
false
4
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |