From 9559158bfeeb274e9ccf1b4563f1b23b42afc493 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Wed, 5 Jul 2023 10:04:55 +0200 Subject: Decompose Kotlin/Java analysis (#3034) * Extract analysis into separate modules --- .../kotlin-as-java/src/main/kotlin/CollectionExtensions.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/kotlin-as-java/src/main/kotlin/CollectionExtensions.kt (limited to 'plugins/kotlin-as-java/src/main/kotlin/CollectionExtensions.kt') diff --git a/plugins/kotlin-as-java/src/main/kotlin/CollectionExtensions.kt b/plugins/kotlin-as-java/src/main/kotlin/CollectionExtensions.kt new file mode 100644 index 00000000..77e4ab0a --- /dev/null +++ b/plugins/kotlin-as-java/src/main/kotlin/CollectionExtensions.kt @@ -0,0 +1,12 @@ +package org.jetbrains.dokka.kotlinAsJava + +// TODO [beresnev] remove this copy-paste and use the same method from stdlib instead after updating to 1.5 +internal inline fun Iterable.firstNotNullOfOrNull(transform: (T) -> R?): R? { + for (element in this) { + val result = transform(element) + if (result != null) { + return result + } + } + return null +} -- cgit