Skip to content

Commit

Permalink
style(internal): make getOrThrow terse and consistent (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Nov 1, 2024
1 parent 8cd6374 commit 1586817
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ import com.google.common.collect.Multimaps
import com.lithic.api.errors.LithicInvalidDataException
import java.util.Collections

internal fun <T : Any> T?.getOrThrow(name: String): T {
if (this == null) {
throw LithicInvalidDataException("'${name}' is not present")
}

return this
}
internal fun <T : Any> T?.getOrThrow(name: String): T =
this ?: throw LithicInvalidDataException("`${name}` is not present")

internal fun <T> List<T>.toUnmodifiable(): List<T> {
if (isEmpty()) {
Expand Down

0 comments on commit 1586817

Please sign in to comment.