diff --git a/domain/src/main/java/ch/dissem/bitmessage/entity/valueobject/InventoryVector.java b/domain/src/main/java/ch/dissem/bitmessage/entity/valueobject/InventoryVector.java index 2b56e62..48667e5 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/entity/valueobject/InventoryVector.java +++ b/domain/src/main/java/ch/dissem/bitmessage/entity/valueobject/InventoryVector.java @@ -21,6 +21,7 @@ import ch.dissem.bitmessage.utils.Strings; import java.io.IOException; import java.io.OutputStream; +import java.util.Arrays; /** * Created by chris on 13.03.15. @@ -31,6 +32,22 @@ public class InventoryVector implements Streamable { */ private final byte[] hash; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof InventoryVector)) return false; + + InventoryVector that = (InventoryVector) o; + + return Arrays.equals(hash, that.hash); + + } + + @Override + public int hashCode() { + return hash != null ? Arrays.hashCode(hash) : 0; + } + public byte[] getHash() { return hash; }