[O] DIVA utils > kt

This commit is contained in:
Azalea
2025-10-25 07:29:09 +08:00
parent 32c3226db7
commit 8d48ab0d3f
23 changed files with 131 additions and 209 deletions

View File

@@ -212,6 +212,8 @@ val <K, V> Map<K, V>.mut get() = toMutableMap()
val <T> Set<T>.mut get() = toMutableSet()
fun <T> List<T>.unique(fn: (T) -> Any) = distinctBy(fn).ifEmpty { null }
val <T> Collection<T>.csv get() = joinToString(",")
val IntArray.csv get() = joinToString(",")
// Optionals
operator fun <T> Optional<T>.invoke(): T? = orElse(null)