Return | Method | Summary |
---|---|---|
boolean | add(E e) | Appends the specified element to the end of this list. |
void | add(int index, E element) | Inserts the specified element at the specified position in this list (optional operation). |
boolean | addAll(Collection<? extends E> c) | Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). |
boolean | addAll(int index, Collection<? extends E> c) | Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
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 has:" + list);
}
}
The output:
List has:[1, 2, 3, java2s.com]
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. |