code: public void save(DataOutputStream out) {
      try {
        out.writeUTF(first.toString());
        out.writeUTF(second.toString());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
docs: Write a string representation of a Pair to a DataStream.
  The <code>toString()</code> method is called on each of the pair
  of objects and a <code>String</code> representation is written.
  This might not allow one to recover the pair of objects unless they
  are of type <code>String</code>.