title: Java Comparable: helper methods for isLessThan, isGreaterThan, isEqualTo
body: <p>For objects a and b implementing the Comparable interface I want to avoid having code like</p>
  
  <pre><code>if (a.compareTo(b) &gt; 0) {
      ...
  }
  </code></pre>
  
  <p>instead, I am looking for helper methods like</p>
  
  <pre><code>if (a.isGreaterThan(b)) {
      ...
  }
  </code></pre>
  
  <p>This would help me a lot for not always having to look up the definition of the return value of compareTo(T o):</p>
  
  <blockquote>
    <p>Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.</p>
  </blockquote>
  
  <p>Really helpful would be 5 different methods:</p>
  
  <pre><code>Instead of                  use potential helper method:
  
  a.compareTo(b) &lt; 0          a.isLessThan(b)
  a.compareTo(b) &lt;= 0         a.isLessOrEqualTo(b)
  a.compareTo(b) == 0         a.isEqualTo(b)
  a.compareTo(b) &gt;= 0         a.isGreaterOrEqualTo(b)
  a.compareTo(b) &gt; 0          a.isGreaterThan(b)
  </code></pre>
  
  <p></p>
  
  <p>Are there any helper methods like this in the JDK or other libraries that provide this kind of functionality?</p>