java
.util
.List
is a child interface of Collection
.
It is an ordered collection of objects.
Since List
preserves the insertion order, it allows positional access and insertion of elements.
List interface is implemented by ArrayList , LinkedList , Vector , and Stack classes.
|
List is an interface, and the instances of List can be created in the following ways:
|
|
List
.
The type-safe List can be defined in the following way:
|
|
List
interface extends Collection
, hence it supports all the operations of Collection
interface, along with the additional operations: add
, remove
, get
, and set
operations such as
void add(int index, Object O)
:
This method adds given element at specified index.