From eb99d328ac37443031b45f8bf737a9ab1b7cda17 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 5 Apr 2024 12:03:05 +0700 Subject: [PATCH] Either#swap --- gradle.properties | 2 +- src/main/kotlin/ru/dbotthepony/kommons/util/Either.kt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4d0e3d6..1d57092 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=2.12.0 +projectVersion=2.12.1 guavaDepVersion=33.0.0 gsonDepVersion=2.8.9 diff --git a/src/main/kotlin/ru/dbotthepony/kommons/util/Either.kt b/src/main/kotlin/ru/dbotthepony/kommons/util/Either.kt index 514b29f..5753d3d 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/util/Either.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/util/Either.kt @@ -63,6 +63,10 @@ class Either private constructor(val left: KOptional, val right: KOptio } } + fun swap(): Either { + return Either(right, left) + } + companion object { @JvmStatic fun left(value: L): Either {