CRange implements WritableComparable<CRange> { @Override public boolean equals(Object other) { LexicographicBytesComparator bytesComparator = LexicographicBytesComparator.INSTANCE; if (!(other instanceof CRange)) { return false; } CRange compare = (CRange) other; if ((start == null && compare.start != null) || end == null && compare.end != null) { return false; } if ((start != null && compare.start == null) || end != null && compare.end == null) { return false; } if (bytesComparator.compare(start, compare.start) == 0) { if (startInclusive == compare.startInclusive) { if (bytesComparator.compare(end, compare.end) == 0) { if (endInclusive == compare.endInclusive) { return true; } } } } return false; } CRange();  CRange(byte[] start);  CRange(byte[] start, byte[] end);  CRange(byte[] start, boolean startInclusive, byte[] end,
      boolean endInclusive); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override int compareTo(CRange other); byte[] getStart(); boolean isStartInclusive(); byte[] getEnd(); boolean isEndInclusive(); @Override boolean equals(Object other); @Override int hashCode(); static final CRange FULL_TABLE_RANGE; }
@Test public void testCRangeEquals() { CRange c1 = new CRange(); CRange c2 = new CRange(new byte[] { 0 }); CRange c3 = new CRange(new byte[] { 0 }, new byte[] { 5 }); CRange c4 = new CRange(new byte[] { 0 }, true, new byte[] { 5 }, false); Assert.assertFalse(c1.equals(null)); Assert.assertFalse(c1.equals(c2)); Assert.assertTrue(c2.equals(c2)); Assert.assertFalse(c2.equals(c3)); Assert.assertFalse(c3.equals(c4)); }