Guava Hasher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava Hasher class.

This code example shows how to use the following methods:hash
    public void write(int b) throws IOException {
        hasher.putInt(b);
    } 
 
    public HashCode getHashCode() {
        return hasher.hash();
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:putShort, putString
                return Short.compare(left.getKey(), right.getKey());
            } 
        }, TimeZoneKey.getTimeZoneKeys());
 
        for (TimeZoneKey timeZoneKey : timeZoneKeysSortedByKey) {
            hasher.putShort(timeZoneKey.getKey());
            hasher.putString(timeZoneKey.getId(), StandardCharsets.UTF_8);
        } 
        // Zone file should not (normally) be changed, so let's make is more difficult 
        assertEquals(hasher.hash().asLong(), 5498515770239515435L, "zone-index.properties file contents changed!");
    } 
} 
5
CodeRank
This code example shows how to use the following methods:hash, putBytes
This code example shows how to use the following methods:hash
This code example shows how to use the following methods:hash
    /** 
     * Finish the description, producing a hash code. 
     * @return The hash code. 
     */ 
    public HashCode finish() {
        return hasher.hash();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:hash
        hasher.putBytes(ByteBufferUtil.toByteArray(buffer));
    } 
 
    @Override 
    public byte[] getChecksum() { 
        return hasher.hash().asBytes();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:hash
        hasher.putBytes(b, off, len);
    } 
 
    @Override 
    public long getValue() { 
        return 0xffffffffL & hasher.hash().asInt();
    } 
 
    @Override 
    public void reset() { 
        hasher = Hashing.murmur3_32().newHasher();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:putBytes
        hasher.putByte((byte)b);
    } 
 
    @Override 
    public void update(byte[] b, int off, int len) {
        hasher.putBytes(b,off,len);
    } 
 
    @Override 
    public long getValue() { 
        return hasher.hash().asLong();
    } 
 
    @Override 
    public void reset() { 
        hasher= Hashing.murmur3_128().newHasher();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:putBytes
    } 
 
    @Override 
    public void write(byte[] b, int off, int len) throws IOException {
        super.write(b, off, len);
        hasher.putBytes(b, off, len);
    } 
 
} 
4
CodeRank
See Code Examples for Guava Hasher Methods: