728x90 collection1 Kotlin collections(List, Set, Map) 기본 사용 List 코틀린 표준함수 listOf 를 이용해 List 를 만든다. 코틀린에서 List 는 처음 만든 후 수정이 불가능하다. 아래는 list 를 만든 후 개수, 인자 값을 가져오는 예시이다. val numbers = listOf("one", "two", "three", "four") println("${numbers.size}") println("${numbers.get(2)}") println("${numbers[3]}") println("${numbers.indexOf("two")}") ----- results ----- 4 three four 1 내부 데이터를 수정할 수 있는 List 가 MutableList 이다. 코틀린 표준함수 mutableListOf 를 이용해 만들 수 있다. 아래는 Mut.. 2020. 12. 13. 이전 1 다음 728x90