JAVA/android_studio
2024. 10. 31. 15:55
-
자바 ArrayList 사용 방법
ArrayList<Integer> integers1 = new ArrayList<Integer>(); // 타입 지정
ArrayList<Integer> integers2 = new ArrayList<>(); // 타입 생략 가능
ArrayList<Integer> integers3 = new ArrayList<>(10); // 초기 용량(Capacity) 설정
ArrayList<Integer> integers4 = new ArrayList<>(integers1); // 다른 Collection값으로 초기화
ArrayList<Integer> integers5 = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5)); // Arrays.asList()
ArrayList<String> colors = new ArrayList<>(Arrays.asList("Black", "White", "Green", "Red"));
https://psychoria.tistory.com/765
[Java] 자바 ArrayList 사용 방법
ArrayList는 자바에서 기본적으로 많이 사용되는 클래스입니다. ArrayList는 자바의 List 인터페이스를 상속받은 여러 클래스 중 하나입니다. 일반 배열과 동일하게 연속된 메모리 공간을 사용하며 인
psychoria.tistory.com
-
'JAVA > android_studio' 카테고리의 다른 글
USB OTG cable - DIY (0) | 2025.04.01 |
---|---|
[Android, DialogFragment] 다이얼로그 프래그먼트 만들기 (0) | 2025.03.21 |
Android screen control - scrcpy , selecting one device between two android phones (1) | 2024.10.29 |
Thread.sleep not crash app (1) | 2024.10.24 |
자바 코드 실행시간 구하기 (2) | 2024.10.23 |