ByteArrayWrapper implements Comparable<ByteArrayWrapper> { public boolean equals(Object other) { if (!(other instanceof ByteArrayWrapper)) return false; byte[] otherData = ((ByteArrayWrapper) other).getData(); return FastByteComparisons.compareTo( data, 0, data.length, otherData, 0, otherData.length) == 0; } ByteArrayWrapper(byte[] data); boolean equals(Object other); @Override int hashCode(); @Override int compareTo(ByteArrayWrapper o); byte[] getData(); @Override String toString();  }
@Test public void testEqualsObject() { assertTrue(wrapper1.equals(wrapper2)); assertFalse(wrapper1.equals(wrapper3)); assertFalse(wrapper1.equals(wrapper4)); assertFalse(wrapper1.equals(null)); assertFalse(wrapper2.equals(wrapper3)); }