title: ClassCastException in Lambda stream
body: <p>I have been playing a little with lambda statements in Java 8, and am stuck: I don't know why this isn't working. </p>
  
  <p>I want the lambda statement to return the array where the sum of the first element, multiplied with the second element, is the highest, in this case {2,3}. </p>
  
  <p>Any help is appreciated.</p>
  
  <pre><code>public static void main(String[] args)
  {
      //Test data
      final TreeSet&lt;Integer[]&gt; test = new TreeSet&lt;Integer[]&gt;();
      test.add( new Integer[]{1,2} );
      test.add( new Integer[]{1,3} );
      test.add( new Integer[]{1,4} );
      test.add( new Integer[]{2,1} );
      test.add( new Integer[]{2,2} );
      test.add( new Integer[]{2,3} );
  
      Integer[] test1 = test.stream()
          .min((Integer[] l , Integer[] r) -&gt; { return Integer.compare( l[0] * l[1] , r[0] * r[1] ); })
          .get(); //Run-time error: java.lang.ClassCastException: [Ljava.lang.Integer; cannot be cast to java.lang.Comparable
  
      Integer[] test2 = test.stream()
          .min((Integer[] l , Integer[] r) -&gt; { return Integer.valueOf( l[0] * l[1] ).compareTo( r[0] * r[1] ); })
          .get(); //Run-time error: java.lang.ClassCastException: [Ljava.lang.Integer; cannot be cast to java.lang.Comparable
  }
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>-PStiger</p>