aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
index 6b4d70046..87261b6d0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
@@ -133,6 +133,9 @@ object CollectionUtils {
return newList
}
+ /**
+ * This does not work inside a [buildList] block
+ */
fun List<String>.addIfNotNull(element: String?) = element?.let { plus(it) } ?: this
fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) =