title: Can not modify value in JavaRDD
body: <p>I have a question about how to update JavaRDD values.</p>
  
  <p>I have a <code>JavaRDD&lt;CostedEventMessage&gt;</code> with message objects containing information about to which partition of kafka topic it should be written to.</p>
  
  <p>I'm trying to change the <code>partitionId</code> field of such objects using the following code:</p>
  
  <pre><code>rddToKafka = rddToKafka.map(event -&gt; repartitionEvent(event, numPartitions));
  </code></pre>
  
  <p>where the <code>repartitionEvent</code> logic is:</p>
  
  <pre><code>costedEventMessage.setPartitionId(1);
  return costedEventMessage;
  </code></pre>
  
  <p>But the modification does not happen.</p>
  
  <p>Could you please advice why and how to correctly modify values in a JavaRDD?</p>