Use ByteArray for map key, fix auth loops

This commit is contained in:
Manfred Karrer 2015-11-11 00:50:56 +01:00
parent b827a9812d
commit 1f3c2c1479
14 changed files with 227 additions and 131 deletions

View file

@ -0,0 +1,32 @@
package io.bitsquare.common;
import io.bitsquare.app.Version;
import java.io.Serializable;
import java.util.Arrays;
public class ByteArray implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
public final byte[] bytes;
public ByteArray(byte[] bytes) {
this.bytes = bytes;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ByteArray)) return false;
ByteArray byteArray = (ByteArray) o;
return Arrays.equals(bytes, byteArray.bytes);
}
@Override
public int hashCode() {
return bytes != null ? Arrays.hashCode(bytes) : 0;
}
}