com.squareup.inject.inflation.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 inflation-inject-processor Show documentation
Show all versions of inflation-inject-processor Show documentation
Constructor-inject views during layout inflation
The newest version!
package com.squareup.inject.inflation.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
}