@Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        ByteArray that = (ByteArray) o;
        // We intentionally use the function to compute hashcode here
        return hashCode() == that.hashCode() && Arrays.equals(bytes, that.bytes);
    }
Can use it as a map key,

@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/ByteArray.java