티스토리 뷰
728x90
반응형
SMALL
List
List 생성
List<String> list = new ArrayList<>();
List에 Data add
list.add("str1");
list.add("str2");
list.add("str3");
...
- List의 0번째부터 순차적으로 add 된다.
List의 Data get
list.get(0);
- list의 0번째에 있는 str1을 가져온다
List의 Data 확인
list.contains("str1");
- list의 값이 있으면 true, 없으면 false를 출력.
- true 출력
List의 Data remove
remove("str");
remove(index);
list.remove("str2");
list.remove(0);
- list의 data 삭제(data값이나, index로 삭제)
728x90
반응형
LIST
'Java > Collection 정리' 카테고리의 다른 글
Set 메소드 정리 (0) | 2021.01.14 |
---|---|
Map 메소드 정리 (0) | 2021.01.14 |
Java Collection 간단 정리. (0) | 2021.01.08 |
댓글