greenhelix
greenhelix
greenhelix
05-13 17:00
  • All (229)
    • Algorithm (118)
      • Algorithm (17)
      • Graph (0)
      • Core (6)
      • Python (18)
      • PythonSnippet (4)
      • Java (59)
      • Kotlin (14)
    • Project (0)
    • Study (8)
      • License (5)
      • EIP (3)
    • Programming (63)
      • Android (41)
      • Flutter (1)
      • Bugs Life (21)
      • Linux (0)
    • Tech (32)
      • Tech (17)
      • Drone (4)
      • Hacking (11)
    • Life (6)
      • INGRESS (1)
      • 심시티빌드잇 (0)
250x250

티스토리

hELLO · Designed By 정상우.
greenhelix

greenhelix

emptyList()
Algorithm/Kotlin

emptyList()

2021. 8. 5. 17:35

비어있는 리스트 표현 [보러가기]

Returns an empty read-only list. The returned list is serializable (JVM).

val list = listOf<String>()
println("list.isEmpty() is ${list.isEmpty()}") // true

// another way to create an empty list,
// type parameter is inferred from the expected type
val other: List<Int> = emptyList()

// Empty lists are equal

println("list == other is ${list == other}") // true
println(list) // []
println(other)
// list[0] //  will fail
728x90
반응형
저작자표시 비영리 변경금지

'Algorithm > Kotlin' 카테고리의 다른 글

Kotlin Data Structure  (0) 2021.10.24
Kotlin 조건문  (0) 2021.04.30
Kotlin 기본 변수 및 연산자  (0) 2021.04.30
    'Algorithm/Kotlin' 카테고리의 다른 글
    • Kotlin collections extension function
    • Kotlin Data Structure
    • Kotlin 조건문
    • Kotlin 기본 변수 및 연산자
    greenhelix
    greenhelix
    개발에 관한 것들과 개인적인 것을 담는 블로그

    티스토리툴바