Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- room
- 코틀린
- HTTP
- Behavior
- onLayout
- kotlin
- 알고리즘
- View
- AppBarLayout
- ViewModel
- lifecycle
- onMeasure
- sqlite
- Coroutine
- DataBinding
- activity
- LiveData
- 백준
- Navigation
- hilt
- Android
- Algorithm
- 알림
- CoordinatorLayout
- BOJ
- CustomView
- CollapsingToolbarLayout
- recyclerview
- notification
- 안드로이드
Archives
- Today
- Total
목록also (1)
개발일지
Kotlin in A..Z - 범위 지정 함수
also 해당 객체를 사용하기 전에 데이터의 유효성을 검사할 때 매우 유용하다. 선언 fun T.also(block: (T) -> Unit): T { block(this) return this } 코드 class Animal { var name: String = "Animal" var age: Int = 0 override fun toString(): String { return "Name : $name, Age : $age" } } fun isDog(animal: Animal) { assert(animal.name == "Dog") } fun main() { val dog = Animal().also { isDog(it) } } apply 특정 객체를 생성하면서 동시에 초기화를 할 때 사용한다. 객체가..
Kotlin (코틀린)
2020. 7. 27. 04:39