Files
kotlin-examples/Writerside/topics/Collection.md
2024-06-21 15:01:25 +09:00

567 B

컬렉션

  • listOf()

  • setOf()

  • mapOf()

  • mutableListOf()

  • mutableSetOf()

  • mutableMapOf()

val numberSet = setOf("one", "two", "three")
val emptySet = mutableSetOf<String>()
val numberMap = mapOf("one" to 1, "two" to 2, "three" to 3)

빌더 함수

  • buildList()

  • buildSet()

  • buildMap()

val map = buildMap{
    put("a", 1)
    put("b", 2)
}

빈 컬렉션

  • emptyList()

  • emptySet()

  • emptyMap()

val empty = emptyList<String>()

복제

  • toList()

  • toMutableList()

  • toSet()