title: Same mapWithState Function used by several JavaDStreams
body: <p>I have 2 JavaPairDStreams. They have the same key(type and value) and the same value type (different value). I need them to share the same state to return a result based the current state, so I use the same mapWithState function.</p>
  
  <pre><code>JavaPairDStream&lt;String, String&gt; inputMessagesStream = readFromKafkaStream1();
  JavaPairDStream&lt;String, String&gt; inputMessagesStream2 = readFromKafkaStream();
  Function3&lt;String, Optional&lt;String&gt;, State&lt;MessageState&gt;, String&gt; messageState = (key, value, state) -&gt; {
                  if (state.exists()) {
                      return state.get().process(value.get());
                  } else {
                      MessageState ms = new MessageState();
                      ms.process(value.get());
                      state.update(ms);
                      return null;
                  }
              };
  
  JavaMapWithStateDStream&lt;String, String, MessageState, String&gt; message1 = inputMessagesStream.mapWithState(StateSpec.function(messageState));
  JavaMapWithStateDStream&lt;String, String, MessageState, String&gt; message2 = inputMessagesStream2.mapWithState(StateSpec.function(messageState));
  </code></pre>
  
  <p>Is it ok to use the same function for 2 different streams? Is the state updated correctly and shared by each stream?</p>