title: How to find the max element from an array list of objects?
body: <p><code>Collections.max(arraylist)</code> doesn't work, and a regular <code>for</code> loop won't work either.</p>
  
  <p>What I have is:</p>
  
  <pre><code>ArrayList&lt;Forecast&gt; forecasts = current.getForecasts();
  </code></pre>
  
  <p><code>Collections.max(forecast)</code> gives me this error: </p>
  
  <pre><code>The method max(Collection&lt;? extends T&gt;) in the type Collections is
  not applicable for the arguments (ArrayList&lt;Forecast&gt;)
  </code></pre>
  
  <p>The <code>ArrayList</code> holds <code>Forecast</code> objects which each has an <code>int</code> field for the temperature of each day. I am trying to store the max in an int max.</p>