E - elemTypepublic class ArrayList<E> extends Object implements List<E>, Serializable
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c)
在指定位置,添加所有元素列表。
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
get(int index) |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c)
移除集合所有信息
(1)批量删除,避免多次合并集合。
|
boolean |
retainAll(Collection<?> c)
返回两个集合的公共部分。
|
E |
set(int index,
E element) |
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex)
截取整个列表
这个列表和 jdk 内置的不同,是属于一份拷贝。
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a)
将当前 list 的元素返回到入参数组中。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, replaceAll, sort, spliteratorparallelStream, removeIf, streampublic ArrayList()
public ArrayList(int capacity)
capacity - 容量大小public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll 在接口中 Collection<E>containsAll 在接口中 List<E>public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index,
Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int lastIndexOf(Object o)
lastIndexOf 在接口中 List<E>public ListIterator<E> listIterator()
listIterator 在接口中 List<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>public <T> T[] toArray(T[] a)
Copyright © 2020. All rights reserved.