본문 바로가기

Java/Method

Collection Interface

Method

Explain

 boolean add(Object o)
 boolean addAll(Collection c)
 지정된 객체나 Collection의 객체를 Collection에 추가

 void clear()

 Collection의 모든 객체를 삭제

 boolean contains(Object o)
 boolean containsAll(Collection c)
 지정된 객체나 Collection의 객체를 Collection에 포함 되어 있는지 확인
 boolean equls(Object o) 동일한 Collection인지 비교

 int hashCode()

 Collection의 hash code를 반환

 boolean isEmpty() Collection이 비어있는지 확인
 Iterator iterator() Collection의 Iterator를 얻어 반환
 boolean remove(Object o) 지정한 객체를 삭제

 boolean remove(Collection c)

 지정된 Collection에 포함된 객체를 모두 삭제

 boolean retainAll(Coolection c) 지정된 Collection에 포함된 객체만을 남기고 다른 객체들은 Collection에서 삭제(변화 여부 true / false로 반환)
 int size() Collection에 저장된 객체의 개수를 반환
 Object[] toArray() Collection에 저장된 객체를 객체배열로 반환
 Object[] toArray(Object[] a) 지정된 배열에 Collection의 객체를 저장해 반환

 

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

Map Interface  (0) 2015.08.19
List Interface  (0) 2015.08.19
Math Class Method  (0) 2015.08.19
StringBuffer Method  (0) 2015.08.19
String Class Constructor & Method  (0) 2015.08.19