title: Java - How best to cycle and store values into an ArrayList
body: <p>I have to be able to store data in a new object, that I am getting from a complex object where each item is held in a <code>List</code>.</p>
  
  <p>The hierarchy is the following:</p>
  
  <pre><code>bookId 
  pageId
  wordId
  </code></pre>
  
  <ul>
  <li><code>bookId</code> is unique and can have zero to many <code>pageId's</code></li>
  <li><code>pageId</code> can have zero to many <code>wordId's</code></li>
  </ul>
  
  <p>I have the data, but I need to cycle through each item and put into an object - <code>ArrayList</code> or similar - so I can pass off to another class, which is expecting a <code>List</code>. In the next class, the data is to be presented in a jsp table. </p>
  
  <p>Can someone please help the best way to do this. Do I need <code>ArrayList</code> or <code>ArrayLists</code>, or is there a simple way to do it?</p>