본문 바로가기

Yebali

검색하기
Yebali
프로필사진 예발이

  • 분류 전체보기 (101)
    • Spring (34)
    • Kotlin (13)
    • Apache (2)
    • Design Pattern (1)
    • DB (6)
    • Kafka (14)
    • Backend Common (20)
    • 설계 (1)
    • AWS (4)
    • Etc (5)
    • 일기장 (0)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
일 월 화 수 목 금 토
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
  • K8s
  • Spring JPA
  • AWS
  • spring kafka
  • bean
  • git
  • spring
  • JPA
  • API
  • CodePipeline
  • QueryDSL
  • ECS
  • cd
  • Entity
  • topic생성
  • Kubernetes
  • centos7
  • Spring Data JPA
  • mysql
  • entity graph
  • mirror maker2
  • producer
  • consumer
  • kafka
  • CI
  • Streams
  • transactionaleventlistener
  • PAGING
  • offsetdatetime
  • Kotlin
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록nullable (1)

Yebali

Kotlin의 nullable변수 처리

코틀린에서는 null을 허용하는 nullable 변수가 별도로 존재한다. 이런 변수들을 일일이 if로 체크해서 로직을 하는 것은 아름답지 못할 수 있다. 다른 방법으로 null을 처리하는 방법을 알아보자. Nullable 변수 처리 null을 처리하는 방법은 아래와 같이 몇가지가 있다 ?. (null safe operator) ?: (elvis operator) !!. (non-null assertion operator) ?. (null safe operater) 참조 연산자를 실행하기 전, 객체의 null 여부를 확인부터 하고 null이라면 뒤따라 오는 연산을 실행하지 않는 연산자 fun main() { var a: String? = null println(a?.toUpperCase()) // 'nul..

Kotlin 2021. 9. 22. 22:00
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바