Minor. Utility moved to a common place
This commit is contained in:
@@ -80,3 +80,7 @@ public fun <T> Iterable<Iterable<T>>.flatten(): List<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun <T: Any> emptyOrSingletonList(item: T?): List<T> = if (item == null) listOf() else listOf(item)
|
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?) {
|
||||||
|
if (t != null) add(t)
|
||||||
|
}
|
||||||
@@ -371,5 +371,3 @@ private fun PsiElement.isInCopiedArea(fileCopiedFrom: JetFile, startOffsets: Int
|
|||||||
range in TextRange(start, end)
|
range in TextRange(start, end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : Any> MutableCollection<T>.addIfNotNull(el: T?) = ContainerUtil.addIfNotNull(this, el)
|
|
||||||
Reference in New Issue
Block a user