diff --git a/gradle.properties b/gradle.properties index 8e48d10..bebc12a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=2.9.24 +projectVersion=2.9.25 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 8bc520a..dd17d71 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/util/KOptional.kt @@ -94,6 +94,14 @@ class KOptional private constructor(private val _value: T, val isPresent: Boo } } + fun orNull(): T? { + if (isPresent) { + return value + } else { + return null + } + } + fun valueEquals(other: Any?): Boolean { if (isPresent) { return _value == other