title: How to achieve always compareTo method should be consistent with the equals method in TreeMap or TreeSet?
body: <p><strong>How to achieve always?</strong></p>
  
  <p>The <code>compareTo</code> method or <code>compare</code> method should be consistent with the <code>equals</code> method of the object being stored in <code>TreeMap</code> or <code>TreeSet</code>?</p>