code: @SuppressWarnings("unchecked")
    public int compareTo(Pair<T1,T2> another) {
      int comp = ((Comparable<T1>) first()).compareTo(another.first());
      if (comp != 0) {
        return comp;
      } else {
        return ((Comparable<T2>) second()).compareTo(another.second());
      }
    }
docs: Compares this <code>Pair</code> to another object.
  If the object is a <code>Pair</code>, this function will work providing
  the elements of the <code>Pair</code> are themselves comparable.
  It will then return a value based on the pair of objects, where
  <code>p &gt; q iff p.first() &gt; q.first() ||
  (p.first().equals(q.first()) && p.second() &gt; q.second())</code>.
  If the other object is not a <code>Pair</code>, it throws a
  <code>ClassCastException</code>.
  
  @param another the <code>Object</code> to be compared.
  @return the value <code>0</code> if the argument is a
  <code>Pair</code> equal to this <code>Pair</code>; a value less than
  <code>0</code> if the argument is a <code>Pair</code>
  greater than this <code>Pair</code>; and a value
  greater than <code>0</code> if the argument is a
  <code>Pair</code> less than this <code>Pair</code>.
  @throws ClassCastException if the argument is not a
  <code>Pair</code>.
  @see java.lang.Comparable