#KT-2067 Fixed
This commit is contained in:
@@ -175,6 +175,20 @@ public inline fun FloatArray.makeString(separator: String = ", ", prefix: String
|
||||
return buffer.toString().sure()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
public inline fun <L: List<Float>> FloatArray.dropWhileTo(result: L, predicate: (Float) -> Boolean) : L {
|
||||
var start = true
|
||||
for (element in this) {
|
||||
if (start && predicate(element)) {
|
||||
// ignore
|
||||
} else {
|
||||
start = false
|
||||
result.add(element)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/** Returns a list containing the first elements that satisfy the given *predicate* */
|
||||
public inline fun <L: List<Float>> FloatArray.takeWhileTo(result: L, predicate: (Float) -> Boolean) : L {
|
||||
for (element in this) if (predicate(element)) result.add(element) else break
|
||||
|
||||
Reference in New Issue
Block a user