Esempio n. 1
0
  @Override
  public boolean equals(Object object) {
    if (object == null || (!(object instanceof Token))) return false;

    Token other = (Token) object;
    return Arrays.equals(this.getBytes(), other.getBytes());
  }
Esempio n. 2
0
  @Override
  public int compareTo(Token other) {

    if (other.equals(this)) return 0;

    if (this.getBytes().length < other.getBytes().length) return -1;

    if (this.getBytes().length > other.getBytes().length) return 1;

    return UnsignedLongs.compare(
        Longs.fromByteArray(Bytes.concat(this.getBytes(), new byte[8])),
        Longs.fromByteArray(Bytes.concat(other.getBytes(), new byte[8])));
  }