Good programmers Java tutorial Share List interface, List itself is a sub-interface Collection interface, with all the methods of the Collection. List now learning system unique to the common method, inspection method has found a unique method List index, which is the largest collection of features.
List: Ordered (collection element into the same order and sequence removed), both indexing elements. Element can be repeated.
| --ArrayList: the underlying data structure is an array, threads are not synchronized, ArrayList replaced Vector, query elements very quickly.
| --LinkedList: the underlying data structure is a linked list, the thread is not synchronized, add or delete elements very quickly.
| --Vector: the underlying data structure is the array of thread synchronization, Vector whether queries and deletions are giant slow.
1, added:
add (index, element): Insert element at the specified index bits.
addAll (index, collection): insert a pile element at the specified index position.
2. Delete:
remove (index): delete the element at the specified index position. Returns the deleted elements.
3, access to:
Objectget (index): Gets the specified element by index.
intindexOf (obj): Gets the index bits specify the first occurrence of the element, if the element does not exist -1;
Therefore, by -1 it may be determined whether there is an element.
intlastIndexOf (Objecto): reverse index position of the specified elements.
ListsubList (start, end): Gets the child list.
4. Review:
Objectset (index, element): to modify the elements of the specified index position.
5, get all the elements:
ListIteratorlistIterator (): list of unique collection of iterators.
List collection supports elements add, delete, change, search.