본문 바로가기

Java/Method

Vector & ArrayList

Method

Explain

 Vector()

 크기가 10인 Vector를 생성

 Vector(Collection c)

 주어진 Collection을 저장할 수 있는 생성자

 Vector(int initialCapacity)

 Vector의 초기용량을 지정할 수 있는 생성자

 Vector(int initialCapacity, int capacityIncrement)

 초기용량과 용량의 증분을 지정할 수 있는 생성자

 void add(int index, Object element)

 지정된 index에 객체를 저장

 boolean add(Object o)

 객체 저장 후 저장 성공 여부 반환

 boolean addAll(Collection c)

 주어진 Collection의 모든 객체를 저장

 boolean addAll(int index, Collection c)

 지정된 위치부터 주어진 Collection의 모든 객체 저장

 void addElement(Object obj)

 객체를 저장

 int capacity()

 Vector의 용량 반환

 void clear()

 Vector를 비움

 Object clone()

 Vector를 복제

 boolean contains(Object elem)

 boolean containsAll(Collection c)

 지정된 객체 또는 Collection의 객체들이 Vector에 포함되어 있는지 확인

 void copyInto(Object[] anArray)

 Vector에 저장된 객체들을 anArray 배열에 저장

 Object elementAt(int index)

 지정된 index에 저장된 객체를 반환

 Enumeration elements()

 Vector에 저장된 모든 객체들을 반환

 void ensureCapacity(int minCapacity) Vector의 용량이 최소한 minCapacity가 되도록 함

 boolean equals(Object o)

 주어진 객체와 같은지 비교

 Object firstElement() 첫 번째로 저장된 객체를 반환

 Object get(int index)

 지정된 index에 저장된 객체를 반환

 int hashCode() Hash Code를 반환
 int indexOf(Object elem, int index) 지정된 객체가 저장된 위치를 찾아 반환
 void insertElementAt(Object obj, int index) 지정된 객체가 저장된 위치를 찾아 반환(지정된 위치부터 탐색)
 boolean isEmpty() Vector가 비어있는지 확인

 Object lastElement()

 Vector가 저장된 마지막 객체를 반환

 int lastIndexOf(Object elem) 객체가 저장된 위치를 끝에서부터 역방향으로 탐색
 int lastIndexOf(Object elem, int index) 객체가 저장된 위치를 지정된 위치부터 역방향으로 탐색
 Object remove(int index) 지정된 index에 있는 객체를 제거
 boolean remove(Object o) 지정한 객체를 제거 후 성공 여부를 반환
 boolean removeAll(Collection c) 지정한 Collection에 저장된 것과 동일한 객체를 Vector에서 제거
 void removeAllElements() clear()와 동일
 boolean removeElement(Object obj) 지정된 객체를 삭제 후 성공 여부 반환
 void removeElementAt(int index) 지정된 index에 저장된 객체를 삭제
 boolean retainAll(Collection c) Vector에 저장된 객체중 주어진 Collection과 공통된 것들만 남기고 나머지 삭제
 Object set(int index, Object element) 주어진 객체를 지정된 index에 저장

 void setElement(Object obj, int index)

 void setSize(int newSize) 

 Vector의 크기를 지정한 크기로 변경
 int size() Vector에 저장된 객체의 개수를 반환
 List subList(int fromIndex, int toIndex) fromindex부터 toindex 사이에 저장된 객체를 반환
 Object[] toArray() Vector에 저장된 모든 객체들을 객체 배열로 반환
 Object[] toArray(Object[] a) Vector에 저장된 모든 객체들을 객체 배열 a에 담아 반환
 String toString() 저장된 모든 객체를 문자열로 출력
 void trimToSize

 빈 공간을 없애 용량을 크기에 맞게 줄임


'Java > Method' 카테고리의 다른 글

Stack  (0) 2015.08.19
LinkedList  (0) 2015.08.19
Map.Entry Interface  (0) 2015.08.19
Map Interface  (0) 2015.08.19
List Interface  (0) 2015.08.19