增加元素到鏈表中
boolean add(Element e) //增加指定元素到鏈表尾部.
void add(int index, Element e) //增加指定元素到鏈表指定位置.
boolean addAll(Collection<? extends E> c) //將指定collection中的所有元素插入到ArrayList中
boolean addAll(int index, Collection<? extends E> c) //從指定的位置開始,將指定collection 中的所有元素插入到ArrayList中
從鏈表中刪除元素
void clear() //從鏈表中刪除所有元素.
E remove(int index) //刪除鏈表中指定位置的元素.
boolean removeIf(Predicate<? super E> filter) //根據重寫Predicate類的test方法選擇刪除集合中的元素
boolean removeAll(Collection<?> c) //移除ArrayList中Collection所包含的所有元素
boolean remove(Object o) //移除ArrayList中首次出現的指定元素(如果存在則移除並返回true,否則返回false)
獲取鏈表中的元素
E get(int index) //獲取鏈表中指定位置處的元素.
Object[] toArray() //獲取一個數組,數組中所有元素是鏈表中的元素.(即將鏈表轉換爲一個數組)
<T> T[] toArray(T[] a) //構造一個數組
List<E> subList(int fromIndex, int toIndex) //獲取從fromIndex到toIndex位置的元素
修改某個元素
E set(int index, E element) //將鏈表中指定位置上的元素替換成新元素。
搜索元素
boolean contains(Object o) //如果鏈表包含指定元素,返回true.
int indexOf(Object o) //返回元素在鏈表中第一次出現的位置,如果返回-1,表示鏈表中沒有這個元素。
int lastIndexOf(Object o) //返回元素在鏈表中最後一次出現的位置,如果返回-1,表示鏈表中沒有這個元素。
檢查鏈表是否爲空
boolean isEmpty() //返回true表示鏈表中沒有任何元素. 判斷邏輯是size == 0
獲取鏈表大小
int size() //返回鏈表長度(鏈表包含元素的個數).