title: Kafka Streams Materialized View with Kotlin
body: <p>To create a kafka streams state store in Java I can do this:</p>
  
  <pre><code>final KGroupedStream&lt;String, String&gt; wordCounts = textLines
              .flatMapValues(value -&gt; Arrays.asList(pattern.split(value.toLowerCase())))
              .groupBy((key, word) -&gt; word);
  
  wordCounts.count(Materialized.&lt;String, Long, KeyValueStore&lt;Bytes, byte[]&gt;&gt;as(WORD_COUNT_STORE));
  </code></pre>
  
  <p>I am attempting to convert this to Kotlin, like this:</p>
  
  <pre><code>val wordCounts: KGroupedStream&lt;String, String&gt; = textLines
          .flatMapValues({value -&gt; value.split("\\W+") })
          .groupBy({ _, word -&gt; word})
  
  wordCounts.count(Materialized.&lt;String, Long, KeyValueStore&lt;Bytes, Array&lt;Byte&gt;&gt;&gt;as(WORD_COUNT_STORE))
  </code></pre>
  
  <p>However, I get the following compiler error:</p>
  
  <pre><code>Interface KeyValueStore does not have constructors
  </code></pre>
  
  <p>What do I need to do?</p>