标签:
ArrayList是一个列表集合,实现了所有的List接口中的方法,允许存放任何元素,包括null,这个类与Vector很相似,除了synchronized不同。它能够根据元素的添加自动的增加集合的长度,默认大小为10。
集合的默认大小10:
Method:
E get(int index)
检查是否超越界限
set(int index,E e)
add(E e)
remove(Object)
Object[] toArray()这个方法是List集合与数组间的桥梁
ensureCapacity(int)确保了集合能够自动增加
在集合中size,isEmpty,get,set,iterator和listIterator操作都是常量时间,而添加n个元素需要O(n)时间,粗略的说其他方法都是线性时间。
标签:
原文地址:http://blog.csdn.net/zxdfc/article/details/51111575