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