2024-06-21

This commit is contained in:
2024-06-21 15:01:25 +09:00
commit b5f6bbb1e0
41 changed files with 1895 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
# 컬렉션
- listOf()
- setOf()
- mapOf()
- mutableListOf()
- mutableSetOf()
- mutableMapOf()
```kotlin
val numberSet = setOf("one", "two", "three")
val emptySet = mutableSetOf<String>()
```
```kotlin
val numberMap = mapOf("one" to 1, "two" to 2, "three" to 3)
```
## 빌더 함수
- buildList()
- buildSet()
- buildMap()
```kotlin
val map = buildMap{
put("a", 1)
put("b", 2)
}
```
## 빈 컬렉션
- emptyList()
- emptySet()
- emptyMap()
```kotlin
val empty = emptyList<String>()
```
## 복제
- toList()
- toMutableList()
- toSet()