Interface List

Summary

An ordered collection that allow duplicate elements (even allow multiple null elements).

The user can access elements by their integer index (position in the list), and search for elements in the list.

 

Major Method

void add(int index, Object element) 
Inserts the specified element at the specified position in this list (optional operation). 

boolean addAll(int index, Collection c) 
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). 

Object get(int index) 
Returns the element at the specified position in this list. 

int indexOf(Object o) 
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. 

int lastIndexOf(Object o) 
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. 

ListIterator listIterator() 
Returns a list iterator of the elements in this list (in proper sequence). 

ListIterator listIterator(int index) 
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. 

Object remove(int index) 
Removes the element at the specified position in this list (optional operation). 

Object set(int index, Object element) 
Replaces the element at the specified position in this list with the specified element (optional operation). 

List subList(int fromIndex, int toIndex) 
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. 

 

 

Reference

Sun's JDK 1.3 Interface java.util.List

 

See Also