### Question:
PairOfFloatString implements WritableComparable<PairOfFloatString> { @Override public boolean equals(Object obj) { PairOfFloatString pair = (PairOfFloatString) obj; return rightElement.equals(pair.getRightElement()) && leftElement == pair.getLeftElement(); } PairOfFloatString();  PairOfFloatString(float left, String right); void readFields(DataInput in); void write(DataOutput out); float getLeftElement(); String getRightElement(); String getValue(); float getKey(); void set(float left, String right); @Override boolean equals(Object obj); int compareTo(PairOfFloatString pair); @Override int hashCode(); @Override String toString(); @Override PairOfFloatString clone();  }### Answer:
@Test public void testComparison2() throws IOException { WritableComparator comparator = new PairOfFloatString.Comparator(); PairOfFloatString pair1 = new PairOfFloatString(1.0f, "hi"); PairOfFloatString pair2 = new PairOfFloatString(1.0f, "hi"); PairOfFloatString pair3 = new PairOfFloatString(0.0f, "hi"); PairOfFloatString pair4 = new PairOfFloatString(0.0f, "a"); PairOfFloatString pair5 = new PairOfFloatString(2.0f, "hi"); assertTrue(pair1.equals(pair2)); assertFalse(pair1.equals(pair3)); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair2) == 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair3) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair4) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair5) < 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair3, pair4) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair4, pair5) < 0); }