Example #1
0
 public boolean equals(Object obj) {
   if (obj instanceof Pair) {
     Pair po = (Pair) obj;
     return po.toString().equals(this.toString());
   }
   return false;
 }
Example #2
0
  public int compareTo(Object o) {

    if (o instanceof Pair) {
      Pair po = (Pair) o;
      String thisString = this.toString();
      String poString = po.toString();
      return thisString.compareTo(poString);
    }
    return -1;
  }