How to write compareTo method for point as oneliner
<p>I want to know if it possible to write this method in one line.  I need to compare y-coordinates and break ties using the x-coordinates. </p>

<pre><code> // comparing y-coordinates and breaking ties by x-coordinates
    public int compareTo(Point p) {

        if (y &lt; p.y) {
          return -1;
        }
        if (y &gt; p.y) {
           return 1;
        }
        if (x &lt; p.x) {
          return -1;
        }
        if (x &gt; p.x) {
         return 1;
        }
       return 0;
    }
</code></pre>

<p>"note. The question is asked out of interest to see if there is any original out of the box solution. It is evident that the presented
               solution is good as"</p>
