|
Objectives : List collection
- List tenders a zero based index to the elements added /stored
- List Can store objects of any type
- Taken from Eclipse Help "An ordered collection (also known as a
sequence). The user of this interface has precise control over where
in the list each element is inserted ".
|
|
List Interface :
- List Interface is the base of other list types
- ArrayList: not thread safe. Tenders random access
- LinkedList: not thread safe, preferred when adding and
removing at the end of list is required.
- Vector: Thread Safe
|
List Basic Operation:
- add(Object), add(index, Object) and addAll() are used to add
elements to the list.
|
|
List methods.
|
add(Object) would allow any data type:
add( specific-data-type) would only allow the similar data type, and
in the case of String data type if you try to add integers, the compiler
would throw an error.
|
|
|
|