title: Why does stream.max() result differ when using comparator in ascending vs descending order?
body: <p>I have the code setup below and I'm a bit confused why the stream.max() returns a different result when Comparator is set up to sort in ascending vs descending order. I know how comparators work to sort an array, but not very clear how max and comparator work with a stream.</p>
  <pre><code>public class Main
  {
      public static void main(String[] args) {
          
          Cat c1 = new Cat(5);
          Cat c2 = new Cat(6);
          Cat c3 = new Cat(7);
  
          ArrayList&lt;Cat&gt; arr = new ArrayList&lt;Cat&gt;();
          arr.add(c1);
          arr.add(c2);
          arr.add(c3);
          
          Optional&lt;Cat&gt; cMax = findMax(arr);
          System.out.println(cMax.get().age);
  
      }
      
      public static Optional&lt;Cat&gt; findMax(ArrayList&lt;Cat&gt; arr) {
          return arr.stream()
            .max((Cat a, Cat b) -&gt; {
              return b.age - a.age;
              // versus a.age - b.age
        });
      }
  }
  
  class Cat{
      int age;
      Cat(int age){
          this.age = age;
      }
  }
  </code></pre>