title: How do I create a java Callable with a lambda in scala?
body: <p>I have this code:</p>
  
  <pre><code>val task = (() =&gt; {
    lineStream
      .parallel()
      .forEach(((line: String) =&gt; {
        val key = extractKeyFromLine(line)
        val random = ThreadLocalRandom.current()
        val csvRecord = gson.toJson(CsvRecordDto(random.nextInt(24), line))
        val record = new StringRecord(topic, key, csvRecord)
        val prod = producer.get()
        prod.send(record, MessageCallback)
      }).asJava.asInstanceOf[Consumer[String]])
  }).asJava
  pool.submit(task).get()
  </code></pre>
  
  <p>The <code>pool</code> variable is a <code>ForkJoinPool</code>. The runtime complains that <code>task</code> is a <code>Supplier</code> and not a <code>Callable</code>.</p>
  
  <p>The <code>.asJava</code> thing is from <code>scala.compat.java8.FunctionConverters._</code>.</p>
  
  <p>How do I fix this in scala 2.11.7?</p>