Ejemplo n.º 1
0
  @Override
  public int compareTo(Key o) {
    if (!(o instanceof ByteValue))
      throw new ClassCastException("Cannot compare " + o.getClass().getName() + " to ByteValue!");

    final byte other = ((ByteValue) o).value;
    return this.value < other ? -1 : this.value > other ? 1 : 0;
  }
Ejemplo n.º 2
0
 @Override
 public boolean equals(Object obj) {
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   final Key other = (Key) obj;
   if (klass != other.getClass() && (klass == null || !klass.equals(other.getKlass()))) {
     return false;
   }
   if ((id == null) ? (other.getId() != null) : !id.equals(other.getId())) {
     return false;
   }
   return true;
 }