Replace lambdas with references

This commit is contained in:
Iaroslav 2020-06-27 21:19:19 +07:00
parent bac6451443
commit b6bf741dbe
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ interface INDArrayStructureBase<T> : NDStructure<T> {
get() = narrowToIntArray(ndArray.shape())
fun elementsIterator(): Iterator<Pair<IntArray, T>>
override fun elements(): Sequence<Pair<IntArray, T>> = Sequence { elementsIterator() }
override fun elements(): Sequence<Pair<IntArray, T>> = Sequence(::elementsIterator)
}
data class INDArrayIntStructure(override val ndArray: INDArray) : INDArrayStructureBase<Int> {

View File

@ -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<IntArray, Double>::second).toList()
assertEquals(listOf(1.0, 2.0, 3.0), res)
}