title: Memory efficient collections in java
body: <p>Our application is a gigaspace based solution, which basically reads from multiple flat files and stores the data in a object. Now flat files basically contain some shipment details. So we have multiple files</p>
  
  <ol>
  <li>Dockyard Details </li>
  <li>Container details </li>
  <li>Shipment Details </li>
  <li>etc.</li>
  </ol>
  
  <p>Now we have <code>Dockyard</code> as a parent object under which there can many objects of shipment details. We currently use an <code>ArrayList</code> to maintain shipment details for almost 50k dockyard detail objects. Current volume of data suggests that for each <code>Dockyard</code> object we will have to maintain around 1500 shipment detail object and there will almost 50k dockyard object lying in heap. Our current heap is 8GB. </p>
  
  <p>So wanted to know if ArrayList is the best way to keep so many object. I have looked for other APIs as well  like <code>trove</code>, <code>HPPC</code> but they mostly offer benefits when it comes to primitive collection. Ours will be a collection of Objects. So other than increasing heap size. can someone suggest any other better alternatives.</p>