Alessandro Tagliapietra
01/06/2020, 5:10 AMKStream<String, Long>[] branches = stream.branch(
(key, value) -> key.startsWith("A"), /* first predicate */
(key, value) -> key.startsWith("B"), /* second predicate */
(key, value) -> true /* third predicate */
);
to kotlin?
I've tried with
val branchedStream = metricStream.branch(
{ k: String, v: MetricWithTimestamp -> v.getType().equals("diagnostic") },
{ k: String, v: MetricWithTimestamp -> true }
)
but I'm getting
Error:(91, 17) Kotlin: Type mismatch: inferred type is (???, ???) -> [ERROR : <ERROR FUNCTION RETURN TYPE>] but Predicate<in String!, in MetricWithTimestamp!>! was expected
even trying with typed arguments I get:
Error:(91, 17) Kotlin: Type mismatch: inferred type is (String, MetricWithTimestamp) -> Boolean but Predicate<in String!, in MetricWithTimestamp!>! was expected
any idea?