stdlib: add flatten()
This commit is contained in:
@@ -79,10 +79,6 @@ public fun <K, V: Any> Iterable<K>.keysToMapExceptNulls(value: (K) -> V?): Map<K
|
||||
|
||||
public fun <T, C: Collection<T>> C.ifEmpty(body: () -> C): C = if (isEmpty()) body() else this
|
||||
|
||||
public fun <T> Iterable<Iterable<T>>.flatten(): List<T> {
|
||||
return flatMapTo(ArrayList<T>(), {it})
|
||||
}
|
||||
|
||||
public fun <T: Any> emptyOrSingletonList(item: T?): List<T> = if (item == null) listOf() else listOf(item)
|
||||
|
||||
public fun <T: Any> MutableCollection<T>.addIfNotNull(t: T?) {
|
||||
|
||||
Reference in New Issue
Block a user