Kotlin Collections overview
·
Kotlin
Collection vs. Mutable Collection 먼저 Kotlin의 다양한 컬렉션 유형에 대해 살펴보겠습니다. 기본 컬렉션 유형을 초기화하는 방법을 살펴보겠습니다. 컬렉션 인터페이스는 읽기 전용 메서드를 지원하는 반면 MutableCollection은 읽기/쓰기 메서드를 지원합니다. List listOf() 메서드를 사용하여 간단한 읽기 전용 List를 생성하고 mutableListOf() 메서드를 사용하여 읽기-쓰기 MutableList를 생성할 수 있습니다: val theList = listOf("one", "two", "three") val theMutableList = mutableListOf("one", "two", "three") Set 마찬가지로 setOf() 메서드를 사용하여 ..