컴퓨터 프로그래밍/알고리즘

[알고리즘] 배열

한33 2024. 10. 7. 10:11

 

.equals()

문자열을 비교할 때는 == 말고 equals 를 사용하자. == 는 주소값 비교이다.

 

Collections.sort(arrayList)

arrayList 의 요소들을 오름차순 정렬시킨다.

 

List<Integer> answerList = new ArrayList<>();

길이가 동적으로 설정되는 aarrayList 가 선언된다.

 

arrayList.add(i)

arrayList 에 i 요소를 추가시킨다.

 

int[] result = new int[arr.length];

result  배열을 선언하고, arr.length 의 길이로 초기화한다.