title: Read and Sort 2 million items in Java at a time
body: <p>Today I have an interview, interviewer asked me this question. He gave me a method asked me what object modelling you would do 
  to call this method with 2 million records. Assume JVM can hold 25k items at a time. Assume we are reading data from database.</p>
  
  <pre><code>public void sort(List&lt;Object&gt; input){
  
      //sort the list and write sorted data to file.
  }
  </code></pre>
  
  <p>I know we need to read data in chunks and process, But how to merge the result at the end?</p>