总结list的办法: List list = new List(); 1、list.add() 在list中增长一个元素,如果只有list.add(Element el)则主动加在list的最后, 并返回一个boolean值 而list.add(int index,element el)则表现在index的地位插入一个元素,无返回值 。 2、list.addAll() 用法同上,有list.addAll(Collection c)和list.addAll(int index,collection c)两种,都返回一个 boolean值。collection类型扩大自java.util.Collection接口。 3、list.get(int index) 返回地位是index的一个元素值。 4、list.retainAll(Collection c) 取得所有c聚集里面有的元素。 5、list.toArray() 把list的所有值返回到一个数组,list.toArray(T[] a) the runtime type of the returned array is that of the specified array.不知道runtime怎样翻译。 :( 6、list.subList(int fromIndex,int toIndex) 返回list地位fromIndex和toIndex之间的list。 7、list.clear() remove all。 8、list.remove(Object o) remove第一个符合o的元素返回boolean 9、list.removeAll(Collection c) 删除list中所有符合c聚集的元素,返回boolean 10、list.set(int index,Element el) 把地位为index的元素图还成el。返回先前的元素值。 11、list.contains(Object o) 如果list中包括o,则返回true,一样list.containsAll(Collection c)也是如此。 12、list.indexOf(Object o) 返回list中o的地位,为int类型。 13、list.isEmpty() 返回true如果list为空。 14、listIterator() 返回一个反复涌现元素的list,list.listIterator(int index)指从index开端盘算 反复元素总结list的办法: List list = new List(); 1、list.add() 在