title: how to apply flatMapToPair on a given rdd?
body: <p>I have a <code>JavaPairRDD&lt;String, List&lt;Tuple2&lt;Integer, Integer&gt;&gt;&gt;</code> named <code>rddA</code>. For example (after collecting <code>rddA</code>): <code>[(word1,[(187,267), (224,311), (187,110)]), (word2,[(187,200), (10,90)])]</code>. Thus, for example, <code>word1</code> is the key and value is <code>[(187,267), (224,311), (187,110)])]</code>.</p>
  
  <p>How can I define the corresponding <code>JavaPairRDD&lt;Integer, List&lt;Integer&gt;&gt;</code> to get the following ouptput:</p>
  
  <pre><code>[(187, [267, 110, 200]), (224,[311]), (10,[90])]
  </code></pre>
  
  <p>So, the obtained <code>JavaPairRDD</code>includes three keys: <code>187, 224</code> and <code>10</code>.  And for example, the key <code>187</code> has <code>[267, 110, 200]</code> as a list value.</p>