Exemplo n.º 1
0
 public int hashKey(K value) {
   try {
     DataByteArrayOutputStream os = new DataByteArrayOutputStream();
     keyCodec.encode(value, os);
     return hash(os.toBuffer());
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 2
0
 public int hashNode(N node, int i) {
   try {
     DataByteArrayOutputStream os = new DataByteArrayOutputStream();
     nodeCodec.encode(node, os);
     os.write(':');
     os.writeInt(i);
     return hash(os.toBuffer());
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }