title: Creating a Sorted 2D Array from custom Object properties
body: <p>I have a List of objects created from a map like so:</p>
  
  <pre><code>Map incomingRequest = (Map)object;
  List accounts = (List)incomingRequest.get("accountList");
  </code></pre>
  
  <p>In addition, I loop through these objects and pull them out one by one via the index of that list like so and create the account object:</p>
  
  <pre><code>for (int accountRow = 0; accountRow &lt; accounts.size(); accountRow++){
      Account account = (Account)accounts.get(accountRow);
  </code></pre>
  
  <p>There is a method on this <code>Account account</code> object that I can use to get an identifier I can sort on called like so: <code>account.getComp_id().getIcLine()</code>. This gives me a non-unique number that I can use to group with. I now have a need to do some calculations involving only the grouping ov like <code>IcLine</code> properties.</p>
  
  <p>My thought is to create a 2D ArrayList so that I can loop through each sorted array of objects sharing the same <code>IcLine</code> number. However, I currently can't figure out exactly how I would do that after googling around and trying to work through it. I feel like this is a good job for recursion, but I can't figure out how to create the 2D ArrayList I need. Your guidance is appreciated</p>