Java/API

[Java API] Class ArrayList<E>

정코드 2019. 3. 27. 11:18


Class ArrayList<E>


java.lang.Object

java.util.AbstractCollection<E>

java.util.AbstractList<E>

java.util.ArrayList<E>




public class ArrayList<E>

extends AbstractList<E>

implements List<E>, RandomAccess, Cloneable, Serializable


List 인터페이스로 구현한 사이즈 변경 가능한 배열입니다.



Constructor


public ArrayList()


초기 용량 10의 비어있는 List를 생성합니다.



Method inherited


from interface java.util.Collection


default Stream<E> stream()



Method


public boolean add(E e)


e를 List의 마지막에 추가합니다.


public E get(int index)


해당 List의 index 번째 요소를 반환합니다.


public boolean isEmpty()


List가 비어있는 경우 true를 반환합니다.


public E remove(int index)


해당 List의 index 번째 요소를 제거합니다.


public int size()


해당 List의 요소 수를 반환합니다.


public void sort(Comparator<? super E> c)


주어진 Comparator c에 의한 순서에 따라 List를 정렬합니다.