ArrayList, extends AbstractList, is roughly equivalent to the Vector class.
ArrayList can expand as needed.
ArrayList does not use synchronized methods.
ArrayList is somewhat faster than Vector.
import java.util.ArrayList;
import java.util.List;
public class MainClass {
public static void main(String[] argv) {
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
for (String s : list) {
System.out.println(s);
}
}
}
|