@Test public void testEqualsForEqualArrays() { byte[] a = new byte[] {1, 2, 3}; byte[] b = new byte[] {1, 2, 3}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }
@Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } }
ByteArray implements Comparable<ByteArray> { @Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } } }
ByteArray implements Comparable<ByteArray> { @Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } } ByteArray(byte... a); }
ByteArray implements Comparable<ByteArray> { @Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } } ByteArray(byte... a); byte[] byteArrayValue(); @Override boolean equals(Object thatObject); @Override int hashCode(); @Override String toString(); @Override int compareTo(ByteArray that); }
ByteArray implements Comparable<ByteArray> { @Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } } ByteArray(byte... a); byte[] byteArrayValue(); @Override boolean equals(Object thatObject); @Override int hashCode(); @Override String toString(); @Override int compareTo(ByteArray that);  }