on SAM, for example if something defines java.util.function.Function as a parameter, you then have t...
x
on SAM, for example if something defines java.util.function.Function as a parameter, you then have to write
myMethod Function { foo -> bar }
in kotlin to pass the function, in java that would just be
myMethod( foo -> bar )
e
could you write example where SAM doesn’t work for Kotlin? As I see, all work fine (even if function is not last parameter):
Copy code
public class TestF {
    public void test(Function<Integer, Integer> action, Integer value) {
        action.apply(value);
    }
}
and call in Kotlin:
Copy code
val instance = TestF()
instance.test( { it * it }, 123)
and if function is last parameter, it become more consistence:
Copy code
val instance = TestF()
instance.test(123) {  it * it }
x
Copy code
assertThat(dump).extracting(
                Function { it.averageIap },
                Function { it.averageRespitoryRate },
                Function { it.averageTemperature },
                Function { it.urineVolumeDelta },
                Function { it.mrn },
                Function { it.start },
                Function { it.end }
            ).containsExactly(1.0, 2.0, 3.0, 4.0, "a", start, end)
@Evgeniy Zaharov apparently this is now worse, detection has regressed
this is just ridiculous, I’m going to switch this code back to java
Copy code
.extracting(Function<FhirConfig, Any?> { it.endpoint }, Function<FhirConfig, Any?> { it.version })