title: Return a `Comparator` from another function
body: <p>Firstly, please let me clear that I'm limited by the API design so please don't change the API,however, private functions can be added.</p>
  
  <pre><code>public class Point implements Comparable&lt;Point&gt; {
  
      public Point(int x, int y)              // constructs the point (x, y)
      public void draw()                      // draws this point
      public void drawTo(Point that)          // draws the line segment from this point to that point
      public String toString()                // string representation
  
      public int compareTo(Point that)        // compare two points by y-coordinates, breaking ties by x-coordinates
      public double slopeTo(Point that)       // the slope between this point and that point
      public Comparator&lt;Point&gt; slopeOrder()   // compare two points by slopes they make with this point
  }
  </code></pre>
  
  <p>The problem arises when I try to override the compare function in the <code>slopeOrder()</code> method. I tried to call the <code>compare()</code> method in the <code>slopeOrder()</code> function but since I don't have any parameters in the API I couldn't.</p>
  
  <p>Please suggest some solutions to return a <code>Comparator&lt;Point&gt;</code> from the <code>slopeOrder()</code> method. </p>