title: Java stream sorting objects based on the double value
body: <p>I have list of <code>X1</code> objects and trying to sort the list based on method <code>obj_function()</code> which returns <code>Double</code> value. </p>
  
  <pre><code>result = custom_obj_list.stream()
      .sorted((x1,x2) -&gt; {
          return -x1.obj_function().compareTo(x2.obj_function());
      }).filter((x2) -&gt; { 
          return x2.obj_function &lt;= 1; 
      }).collect(Collectors.toList());
  </code></pre>
  
  <p>But I'm struggling to solve the below error message</p>
  
  <blockquote>
    <p>stream().sorted() cannot resolve symbol or cannot resolve method</p>
  </blockquote>