| 메서드 |
설명 |
| ArrayList() |
크기가 0인 ArrayList 생성 |
| ArrayList(Collection c) |
주어진 컬렉션이 저장된 ArrayList를 생성 |
| ArrayList(int initialCapacity) |
지정된 초기용량을 갖는 ArrayList 생성 |
| boolean add(Object o) |
ArrayList의 마지막에 객체를 추가, 성공하면 true |
| void add(int index, Object element) |
지정된 위치(index)에 객체(element)를 저장 |
| boolean addAll(Collection c) |
주어진 컬렉션의 모든 객체를 저장 |
| boolean addAll(int index, Collection c) |
지정된 위치부터 주어진 컬렉션의 모든 객체를 저장 |
| void clear() |
ArrayList를 완전히 비움 |
| Object clone() |
ArrayList를 복제 |
| boolean contains(Object o) |
지정된 객체(o)가 ArrayList에 포함되어 있는지 확인 |
| void ensureCapacity(int minCapacity) |
ArrayList의 용량이 최소한 minCapacity가 되도록 함 |
| Object get(int index) |
지정된 위치(index)에 저장된 객체를 반환 |
| int indexOf(Object o) |
지정된 객체가 저장된 위치를 찾아서 반환 |
| boolean isEmpty() |
ArrayList가 비어있는지 확인 |
| Iterator iterator() |
ArrayList의 Iterator 객체를 반환 |
| int lastIndexOf(Object o) |
객체(o)가 저장된 위치를 끝부터 역방향으로 검색해서 반환 |
| ListIterator listIterator() |
ArrayList의 ListIterator를 반환 |
| ListIterator listIterator(int index) |
ArrayList의 지정된 위치부터 시작하는 ListIterator를 반환 |
| Object remove(int index) |
지정된 위치(index)에 있는 객체를 제거 |
| boolean remove(Object o) |
지정된 객체를 제거 (성공하면 true, 실패하면 false) |
| boolean removeAll(Collection c) |
지정된 컬렉션에 저장된 것과 동일한 객체들을 ArrayList에서 제거 |
| boolean retainAll(Collection c) |
ArrayList에 저장된 객체 중 주어진 컬렉션과 공통된 것들만 남기고 나머지 삭제 |
| Object set(int index, Object element) |
주어진 객체(element)를 지정된 위치(index)에 저장 |
| int size() |
ArrayList에 저장된 객체의 개수를 반환 |
| void sort(Comparator c) |
지정된 정렬기준(c)으로 ArrayList를 정렬 |
| List subList(int fromIndex, int toIndex) |
fromIndex부터 toIndex 사이에 저장된 객체를 반환 |
| Object[] toArray() |
ArrayList에 저장된 모든 객체들을 객체 배열로 반환 |
| Object[] toArray(Object[] a) |
ArrayList에 저장된 모든 객체들을 객체 배열 a에 담아 반환 |
| void trimToSize() |
용량을 크기에 맞게 줄임(빈 공간을 삭제) |