本文整理汇总了Java中com.google.common.hash.Hasher.putObject方法的典型用法代码示例。如果您正苦于以下问题:Java Hasher.putObject方法的具体用法?Java Hasher.putObject怎么用?Java Hasher.putObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.hash.Hasher
的用法示例。
在下文中一共展示了Hasher.putObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBasics
import com.google.common.hash.Hasher; //导入方法依赖的package包/类
@Test
public void testBasics() {
Hasher hasher = NullHasher.INSTANCE;
assertEquals(0, hasher.hash().asInt());
hasher.putBoolean(false);
hasher.putByte((byte) 3);
hasher.putBytes(new byte[0]);
hasher.putBytes(null, 3, 3);
hasher.putChar('c');
hasher.putDouble(3.3);
hasher.putFloat(3.4f);
hasher.putInt(7);
hasher.putLong(3);
hasher.putObject(null, null);
hasher.putShort((short) 7);
hasher.putString(null, null);
hasher.putUnencodedChars(null);
}
示例2: hashObjWithSalt
import com.google.common.hash.Hasher; //导入方法依赖的package包/类
/**
* hashes the object with an additional salt. For purpose of the cuckoo
* filter, this is used when the hash generated for an item is all zeros.
* All zeros is the same as an empty bucket, so obviously it's not a valid
* tag.
*/
HashCode hashObjWithSalt(T object, int moreSalt) {
Hasher hashInst = hasher.newHasher();
hashInst.putObject(object, funnel);
hashInst.putLong(seedNSalt);
hashInst.putInt(moreSalt);
return hashInst.hash();
}
示例3: putObject
import com.google.common.hash.Hasher; //导入方法依赖的package包/类
@Override
public <T> Hasher putObject(T instance, Funnel<? super T> funnel) {
for (Hasher hasher : hashers) {
hasher.putObject(instance, funnel);
}
return this;
}
示例4: hashObj
import com.google.common.hash.Hasher; //导入方法依赖的package包/类
HashCode hashObj(T object) {
Hasher hashInst = hasher.newHasher();
hashInst.putObject(object, funnel);
hashInst.putLong(seedNSalt);
return hashInst.hash();
}
示例5: hash
import com.google.common.hash.Hasher; //导入方法依赖的package包/类
public static byte[] hash(HashFunction hf,String catname,Object[] obj){
Hasher digest = hf.newHasher();
digest.putString(catname, UTF);
digest.putObject(obj, funnel);
return digest.hash().asBytes();
}