utilities.Collections.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dokka-core Show documentation
Show all versions of dokka-core Show documentation
Dokka is an API documentation engine for Kotlin and Java, performing the same function as Javadoc for Java
package org.jetbrains.dokka.utilities
import org.jetbrains.dokka.InternalDokkaApi
/**
* This utility method was previously imported from `org.jetbrains.kotlin.utils.addToStdlib`,
* and there were a lot of usages. Since no replacement exists in stdlib, it was implemented
* locally for convenience.
*/
@InternalDokkaApi
inline fun Iterable<*>.firstIsInstanceOrNull(): T? {
for (element in this) if (element is T) return element
return null
}
/**
* This utility method was previously imported from `org.jetbrains.kotlin.utils.addToStdlib`,
* and there were a lot of usages. Since no replacement exists in stdlib, it was implemented
* locally for convenience.
*/
@InternalDokkaApi
inline fun Sequence<*>.firstIsInstanceOrNull(): T? {
for (element in this) if (element is T) return element
return null
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy