From ed1840a315c6d37848a0edf590f9d9d937b2f955 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 9 Mar 2024 17:35:52 +0700 Subject: [PATCH] Variant KOptional --- gradle.properties | 2 +- src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index e892bb1..e014b4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=2.9.17 +projectVersion=2.9.18 guavaDepVersion=33.0.0 gsonDepVersion=2.8.9 diff --git a/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt b/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt index 61a292d..265d8bf 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt @@ -59,7 +59,7 @@ class KOptional private constructor(private val _value: T, val isPresent: Boo } @Suppress("NOTHING_TO_INLINE") - inline fun orElse(value: T): T { + inline fun orElse(value: E): T { if (isPresent) { return this.value } else { @@ -67,7 +67,7 @@ class KOptional private constructor(private val _value: T, val isPresent: Boo } } - inline fun orElse(value: () -> T): T { + inline fun orElse(value: () -> E): T { if (isPresent) { return this.value } else { @@ -75,11 +75,11 @@ class KOptional private constructor(private val _value: T, val isPresent: Boo } } - infix fun or(value: KOptional): KOptional { + infix fun or(value: KOptional): KOptional { if (isPresent) { return this } else { - return value + return value as KOptional } }