adproperties now has transforms list; assembler can make transformed skeleton

new fun: LinearSearch(By)
This commit is contained in:
minjaesong
2019-01-06 22:43:50 +09:00
parent 32afb2e2e5
commit 344e4ebdab
8 changed files with 145 additions and 40 deletions

View File

@@ -724,3 +724,18 @@ fun interpolateLinear(scale: Double, startValue: Double, endValue: Double): Doub
}
return (1.0 - scale) * startValue + scale * endValue
}
fun <T> List<T>.linearSearch(selector: (T) -> Boolean): Int? {
this.forEachIndexed { index, it ->
if (selector.invoke(it)) return index
}
return null
}
fun <T> List<T>.linearSearchBy(selector: (T) -> Boolean): T? {
this.forEach {
if (selector.invoke(it)) return it
}
return null
}