title: Java Lambda Expression: incompatible types: bad return type in lambda expression
body: <p>I have the following list of jobs, each element is a list containing profit and difficulty:</p>
  
  <pre><code>List&lt;List&lt;Integer&gt;&gt; jobs = new ArrayList&lt;&gt;();
  for (int i = 0; i &lt; difficulty.length; i++) {
      List&lt;Integer&gt; job = new ArrayList&lt;Integer&gt;();
      job.add(profit[i]);
      job.add(difficulty[i]);
      jobs.add(job);
  }
  </code></pre>
  
  <p>Now I want to sort the jobs based on their profit (first element of each job) like below:</p>
  
  <pre><code>jobs.sort((j1, j2) -&gt; j1.get(0) &gt; j2.get(0));
  </code></pre>
  
  <p>But got the following error:</p>
  
  <pre><code>error: incompatible types: bad return type in lambda expression
  </code></pre>
  
  <p>What did I do wrong and how do I fix this? Thanks!</p>