What class does ArrayList belong to? I was trying to find it in the API Specs but couldn't. I am needing to find out what the different is between an ArrayList and java.awt.List other than the fact that java.awt.List is a component. If you don't draw it, do they work the same?? Advantages, disadvantages to both? ------------------ Happy Coding, Gregg Bolinger
public class ArrayList extends AbstractList implements List, Cloneable, Serializable Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.) The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation. Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size. As elements are added an ArrayList, its capacity grows automatically. The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost. An application can increase the capacity of an ArrayList instance before adding a large number of elements using the ensureCapacity operation. This may reduce the amount of incremental reallocation. Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList method. This is best done at creation time, to prevent accidental unsynchronized access to the list: List list = Collections.synchronizedList(new ArrayList(...));
The iterators returned by this class's iterator and listIterator methods are fail-fast: if list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
Since: JDK1.2 See Also: Collection, List, LinkedList, Vector, Collections.synchronizedList(List), Serialized Form
You will need to check the API for more details. Java.util.List is different from java.awt.List ArrayList is a class in the java.util package. It imlements the List interface in the same package. It's a collection, and is used for storing just about anyting (it accepts an object). Java.awt.List is a GUI component that.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Thanks a mil for all the responses!!! Cindy - I did not get an E-mail telling me someone responded to this discussion. And I did select that option. Who do I need to contact about that? If you know that is.. Thank again everyone!!
------------------ Happy Coding, Gregg Bolinger
Joined: May 17, 2001
Gregg in case you didn't know, If you have the API on your hard-drive, use the jdk\docs\api\index.html. This has 3 frames. The top left all packages. The bottom left all classes (makes it easy to find when you don't know the package). The rest contains the actual class api.