Text implements Byteable, Comparable<Text> { @Override public int compareTo(Text o) { return toString().compareTo(o.toString()); } private  Text(String text); private  Text(String text, @Nullable ByteBuffer bytes); static Text fromByteBuffer(ByteBuffer bytes); static Text wrap(String string); static Text wrapCached(String string); @Override int compareTo(Text o); @Override void copyTo(ByteSink sink); @Override boolean equals(Object obj); @Override ByteBuffer getBytes(); @Override int hashCode(); @Override int size(); @Override String toString(); static final Text EMPTY; }
@Test public void testCompareTo() { String s1 = TestData.getString(); String s2 = TestData.getString(); Text t1 = Text.wrap(s1); Text t2 = Text.wrap(s2); Assert.assertEquals(s1.compareTo(s2), t1.compareTo(t2)); }