From f8983b304759df4bf128876b25a887e7b63bcff8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Nov 2024 22:40:02 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=9A=B8=20Add=20method=20that=20turns=20any?= =?utf8?q?=20object=20into=20a=20java.util.Optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/net/pterodactylus/rhynodge/utils/Optionals.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/utils/Optionals.kt b/src/main/kotlin/net/pterodactylus/rhynodge/utils/Optionals.kt index 00e9fea..e51b36d 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/utils/Optionals.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/utils/Optionals.kt @@ -4,3 +4,4 @@ import com.google.common.base.Optional fun T?.asOptional(): Optional = Optional.fromNullable(this) fun String?.asOptional(): Optional = if ((this == null) || (this.isEmpty())) Optional.absent() else Optional.of(this) +fun String?.toOptional(): java.util.Optional = java.util.Optional.ofNullable(this) -- 2.7.4