tests changed
val hasNext -> fun hasNext()
This commit is contained in:
@@ -155,12 +155,12 @@ public inline fun DoubleArray.foldRight(initial: Double, operation: (Double, Dou
|
||||
*/
|
||||
public inline fun DoubleArray.reduce(operation: (Double, Double) -> Double): Double {
|
||||
val iterator = this.iterator().sure()
|
||||
if (!iterator.hasNext) {
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
|
||||
var result: Double = iterator.next() //compiler doesn't understand that result will initialized anyway
|
||||
while (iterator.hasNext) {
|
||||
while (iterator.hasNext()) {
|
||||
result = operation(result, iterator.next())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user