We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getOrThrow
1 parent 8f9e6fa commit a2f92fbCopy full SHA for a2f92fb
1 file changed
lithic-java-core/src/main/kotlin/com/lithic/api/core/Utils.kt
@@ -9,13 +9,8 @@ import com.lithic.api.errors.LithicInvalidDataException
9
import java.util.Collections
10
11
@JvmSynthetic
12
-internal fun <T : Any> T?.getOrThrow(name: String): T {
13
- if (this == null) {
14
- throw LithicInvalidDataException("'${name}' is not present")
15
- }
16
-
17
- return this
18
-}
+internal fun <T : Any> T?.getOrThrow(name: String): T =
+ this ?: throw LithicInvalidDataException("`${name}` is not present")
19
20
21
internal fun <T> List<T>.toUnmodifiable(): List<T> {
0 commit comments