PrimaryKey implements Byteable, Comparable<PrimaryKey> { @Override public int compareTo(PrimaryKey other) { return UnsignedLongs.compare(data, other.data); } private  PrimaryKey(long data); private  PrimaryKey(long data, @Nullable ByteBuffer bytes); static PrimaryKey fromByteBuffer(ByteBuffer bytes); static PrimaryKey wrap(long data); @Override int compareTo(PrimaryKey other); @Override void copyTo(ByteSink sink); @Override boolean equals(Object obj); @Override ByteBuffer getBytes(); @Override int hashCode(); long longValue(); @Override int size(); @Override String toString(); static final int SIZE; }
@Test public void testCompareTo() { long value1 = TestData.getLong(); value1 = value1 == Long.MAX_VALUE ? value1 - 1 : value1; long value2 = value1 + 1; PrimaryKey key1 = PrimaryKey.wrap(value1); PrimaryKey key2 = PrimaryKey.wrap(value2); Assert.assertTrue(key1.compareTo(key2) < 0); }