ArrayList:是List的主要实现类(需要设计到有没有的方法,都会调用equals)
List中相对Collection 新增加的方法:
void add(int index,Object obj) 在指定位置加obj
boolean addAll(int index,Collection coll) 在执行位置插入coll
Object get(int index) 获取指定位置的元素
int indexOf(Object obj) 获取指定元素首次出现的位置,若无返回-1
int lastIndexOf(Object obj) 返回obj 最后一次出现的位置,若无返回-1
Object remove(int index) 移除指定位置的元素
Object set(int index, Object ele) 更改指定位置的元素
List subList(int fromIndex,int toIndex) 返回一个子List [5,7)
List常用方法:
增(add(Object obj))删(remove)
改(set(int index,Object ele))
查(get)
插(add(int index,Object o))
长度(size())