Programming/Java2010. 6. 22. 23:56

import java.util.ArrayList;

ArrayList<Egg> myList = new ArrayList<Egg>(); 
// 새로 만듭니다.

Egg s = new Egg();
myList.add(s);
// 객체 매개변수 Egg를 목록에 추가합니다.

int theSize = myList.size();
// 현재 목록에 들어있는 원소의 개수를 리턴합니다.

boolean isIn = myList.contains(s);
// 객체 매개변수 s가 목록에 있으면 true를 리턴합니다.

int idx = myList.indexOf(s);
// 객체 매개변수 s의 인덱스 또는 -1을 리턴합니다.

boolean empty = myList.isEmpty();
// 목록에 아무 원소도 없으면 true를 리턴합니다.

myList.remove(s);
// 주어진 객체가 ArrayList에 있으면 그 객체를 제거합니다.

myList.get(int index);
// 주어진 index 매개변수 위치에 있는 객체를 리턴합니다.
Posted by zzibong