title: Find max value from generic arraylist
body: <p>I want to write a method to find the max value of arraylist. It could be integer or double type.</p>
  <p>I believe the below code works for arrays, but not for arraylist?</p>
  <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; T maxValue(T[] array){       
       T max = array[0];
       for(T data: array){
            if(data.compareTo(max)&gt;0)
                max =data;                
       }
       return max;
  }
  </code></pre>