Package com.google.common.hash

Examples of com.google.common.hash.HashCode.asLong()


        code = hf.hashObject(new Person(1, "Jiyun", "Xie", 1985), PersonFunnel.INSTANCE);
        System.out.println("Code2 => " + code.asInt());
        // Consistent Hashing
        HashFunction hf2 = Hashing.goodFastHash(64);
        code = hf2.hashObject(new Person(1, "Jiyun", "Xie", 1984), PersonFunnel.INSTANCE);
        System.out.println("Code3 => " + code.asLong());
        long hash = code.asLong();
        int bucket = Hashing.consistentHash(code, 100);
        System.out.println("Bucket1 => " + bucket);
        bucket = Hashing.consistentHash(hash, 101);
        System.out.println("Bucket2 => " + bucket);
View Full Code Here


        System.out.println("Code2 => " + code.asInt());
        // Consistent Hashing
        HashFunction hf2 = Hashing.goodFastHash(64);
        code = hf2.hashObject(new Person(1, "Jiyun", "Xie", 1984), PersonFunnel.INSTANCE);
        System.out.println("Code3 => " + code.asLong());
        long hash = code.asLong();
        int bucket = Hashing.consistentHash(code, 100);
        System.out.println("Bucket1 => " + bucket);
        bucket = Hashing.consistentHash(hash, 101);
        System.out.println("Bucket2 => " + bucket);
        for (int i = 0; i < 10; ++i) {
View Full Code Here

  }

  public long hashToLong(byte[] data) {
    HashCode hashCode = byteArrayHasher.hashBytes(data);

    return hashCode.asLong();
  }


  /**
   * A special version for long integers
View Full Code Here

    addHashItem( hash, Long.toString( hash));
  }
 
  public void addItem( String str) {
    HashCode hc = HASH.hashUnencodedChars( str);
    this.addHashItem( hc.asLong(), str);
  }
 
  public List<String> getMinHashItems() {
    return new ArrayList(this.sortedMap.values());
  }
View Full Code Here


  public Long evaluate( String str) {
    HashCode hc = hash.hashUnencodedChars( str);

    return hc.asLong();
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.