Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-23 14:29:37 +08:00
parent 0b8efe6d02
commit 125b301a32
3 changed files with 74 additions and 17 deletions

View file

@ -18,4 +18,9 @@ fun <T> Collection<T>.isSingleItem(): Boolean = this.size == 1
*/
fun <T> Collection<T>.copy(): Collection<T> {
return this.map { it }
}
inline fun <T> List<T>.indexOfFirstOrNull(predicate: (T) -> Boolean): Int? {
val index = indexOfFirst(predicate)
return if (index == -1) null else index
}