Skip to content

Commit

Permalink
#178 [feat] safeLet 확장함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Aug 16, 2022
1 parent e0d59a0 commit 8ee6623
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/com/hous/hous_aos/util/SafeLet.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.hous.hous_aos.util

/**
* 변수 2가지 이상 null 체크할 때 사용 */
inline fun <T1 : Any, T2 : Any, R : Any> safeLet(p1: T1?, p2: T2?, block: (T1, T2) -> R?): R? {
return if (p1 != null && p2 != null) block(p1, p2) else null
}

0 comments on commit 8ee6623

Please sign in to comment.