TableRange implements Comparable<TableRange> { public Range getRange() { Text tper = Optional.ofNullable(prevEndRow).map(ByteUtil::toText).orElse(null); Text ter = Optional.ofNullable(endRow).map(ByteUtil::toText).orElse(null); return new Range(tper, false, ter, true); } TableRange(Bytes per, Bytes er); @Override int hashCode(); @Override boolean equals(Object o); Bytes getPrevEndRow(); Bytes getEndRow(); boolean contains(Bytes row); @Override String toString(); static List<TableRange> fromBytes(Collection<Bytes> rows); static List<TableRange> fromTexts(Collection<Text> rows); Range getRange(); @Override int compareTo(TableRange other);  }
@Test public void testToRange() { for (String prev : new String[] {null, "foo"}) { for (String end : new String[] {null, "zoo"}) { Assert.assertEquals(new Range(prev, false, end, true), new TableRange(prev == null ? null : Bytes.of(prev), end == null ? null : Bytes.of(end)) .getRange()); } } }