com.squareup.inject.assisted.processor.internal.kotlinStdlib.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assisted-inject-processor Show documentation
Show all versions of assisted-inject-processor Show documentation
Assisted injection for JSR 330
package com.squareup.inject.assisted.processor.internal
// TODO https://youtrack.jetbrains.com/issue/KT-4734
fun Map.filterNotNullValues(): Map {
@Suppress("UNCHECKED_CAST")
return filterValues { it != null } as Map
}
/** Equivalent to `this as T` for use in function chains. */
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE")
inline fun Any.cast(): T = this as T
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE")
inline fun Iterable<*>.castEach() = map { it as T }
inline fun T.applyEach(items: Iterable, func: T.(I) -> Unit): T {
items.forEach { item -> func(item) }
return this
}