2025-01-16 (목)
MutableList, mutableListOf()변경 가능한 리스트를 다룰 때 사용.MutableList인터페이스이므로, 자체적으로 객체를 생성할 수 없으며, 이를 구현한 클래스나 함수를 통해 인스턴스를 생성해야 함.add, remove, clear 등과 같은 수정 작업 지원.val list: MutableList = mutableListOf("a", "b", "c")list.add("d") // "d" 추가list.remove("b") // "b" 제거println(list) // [a, c, d]mutableListOf()인터페이스를 구현한 리스트 객체를 생성하는 함수.인스턴스 생성 시 요소를 초기값으로 바로 전달할 수 있음.val list = mutableListOf("a", "b", "c") /..
2025. 1. 16.