title: Hadoop: How to collect output of Reduce into a Java HashMap
body: <p>I'm using Hadoop to compute co-occurrence similarity between words. I have a file that consists of co-occurring word pairs that looks like:</p>
  
  <pre><code>a b
  a c
  b c
  b d
  </code></pre>
  
  <p>I'm using a <strong>Graph</strong> based approach that treats words as nodes and co-occurring words have an edge between them. My algorithm needs to compute the degree of all nodes. I've successfully written a <code>Map-Reduce</code> job to compute the total degree which outputs the following:</p>
  
  <pre><code>a 2
  b 3
  c 2
  d 1
  </code></pre>
  
  <p>Currently, the output is written back to a file but what I want instead is to capture the result into, say, a <code>java.util.HashMap</code>. I, then, want to use this <code>HashMap</code> in an other <code>Reduce</code> job to compute the final similarity.</p>
  
  <p>Here are my questions:</p>
  
  <ol>
  <li>Is it possible to capture results of reduce job in memory (<code>List</code>, <code>Map</code>). If so, how ?</li>
  <li>Is this the best approach ? If not, How should I deal with this ?</li>
  </ol>