From b6bf741dbe72afdcbc311d6ac89ac8700ac81cb4 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Sat, 27 Jun 2020 21:19:19 +0700 Subject: [PATCH] Replace lambdas with references --- .../main/kotlin/scientifik.kmath.nd4j/ScalarsND4JStructure.kt | 2 +- .../test/kotlin/scientifik/kmath/nd4j/INDArrayStructureTest.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kmath-nd4j/src/main/kotlin/scientifik.kmath.nd4j/ScalarsND4JStructure.kt b/kmath-nd4j/src/main/kotlin/scientifik.kmath.nd4j/ScalarsND4JStructure.kt index ef8c3ec2e..3ffcc110d 100644 --- a/kmath-nd4j/src/main/kotlin/scientifik.kmath.nd4j/ScalarsND4JStructure.kt +++ b/kmath-nd4j/src/main/kotlin/scientifik.kmath.nd4j/ScalarsND4JStructure.kt @@ -10,7 +10,7 @@ interface INDArrayStructureBase : NDStructure { get() = narrowToIntArray(ndArray.shape()) fun elementsIterator(): Iterator> - override fun elements(): Sequence> = Sequence { elementsIterator() } + override fun elements(): Sequence> = Sequence(::elementsIterator) } data class INDArrayIntStructure(override val ndArray: INDArray) : INDArrayStructureBase { diff --git a/kmath-nd4j/src/test/kotlin/scientifik/kmath/nd4j/INDArrayStructureTest.kt b/kmath-nd4j/src/test/kotlin/scientifik/kmath/nd4j/INDArrayStructureTest.kt index e851f2e80..235b65556 100644 --- a/kmath-nd4j/src/test/kotlin/scientifik/kmath/nd4j/INDArrayStructureTest.kt +++ b/kmath-nd4j/src/test/kotlin/scientifik/kmath/nd4j/INDArrayStructureTest.kt @@ -9,7 +9,7 @@ internal class INDArrayStructureTest { fun testElements() { val nd = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0))!! val struct = INDArrayDoubleStructure(nd) - val res = struct.elements().map { it.second }.toList() + val res = struct.elements().map(Pair::second).toList() assertEquals(listOf(1.0, 2.0, 3.0), res) }