Kotlin and JDK8

Kotlin has some connection with Java Threads, Executors and ExecutorServices in kotlin.concurrent but it is all very limited and low-level; not really the right abstractions for applications development. Is anyone working on kotlin.concurrent to make it useful? In particular is anyone working on extensions so as to use streams in JDK8?

I tried using an IntStream directly from Kotlin and it looks as though it will, sort of, work. The core problem is how to tranform a Kotlin function literal into a form suitable for use with sJDK8 streams.

Thanks.

Some future version of Kotlin stabdard library will support JDK streams.

What kind of probleams do you have using Kotlin lambdas for JDK streams? Don’t SAM conversions work for you automatically? Could you show me a code example? Thanks.

I had a code involving the expression:

IntStream.range(1, n)!!.parallel()!!.mapToDouble({(i:Integer):java.lang.Double ->
  val x = (i - 0.5) * delta
  1.0 / (1.0 + x * x)
}).sum()

but the error message is:

Type mismatch.
  Required:java.util.function.IntToDoubleFunction?
  Found: (java.lang.Integer) → java.lang.Double

Does saying "Int" instead of "Integer" help?

No. But if I try:

(i:Int):Double

it works fine. :-)  I thought I had tried that and it had failed, but clearly I had a memory fail.

Thanks for the prompt to get it right.