本文整理匯總了Java中com.google.common.hash.HashCode.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java HashCode.equals方法的具體用法?Java HashCode.equals怎麽用?Java HashCode.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.hash.HashCode
的用法示例。
在下文中一共展示了HashCode.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldReload
import com.google.common.hash.HashCode; //導入方法依賴的package包/類
public boolean shouldReload() {
if(context == null) return true;
if(!configuration.autoReload()) return false;
if(context.loadedFiles().isEmpty()) return configuration.reloadWhenError();
try {
for(Map.Entry<Path, HashCode> loaded : context.loadedFiles().entrySet()) {
HashCode latest = Files.hash(loaded.getKey().toFile(), Hashing.sha256());
if(!latest.equals(loaded.getValue())) return true;
}
return false;
} catch (IOException e) {
return true;
}
}
示例2: affectedSince
import com.google.common.hash.HashCode; //導入方法依賴的package包/類
private DependentsSet affectedSince(JarSnapshot other) {
final Set<String> affected = new HashSet<String>();
for (Map.Entry<String, HashCode> otherClass : other.getHashes().entrySet()) {
String otherClassName = otherClass.getKey();
HashCode otherClassBytes = otherClass.getValue();
HashCode thisClsBytes = getHashes().get(otherClassName);
if (thisClsBytes == null || !thisClsBytes.equals(otherClassBytes)) {
//removed since or changed since
affected.add(otherClassName);
DependentsSet dependents = other.getAnalysis().getRelevantDependents(otherClassName);
if (dependents.isDependencyToAll()) {
return dependents;
}
affected.addAll(dependents.getDependentClasses());
}
}
return new DefaultDependentsSet(affected);
}
示例3: syncRegularFile
import com.google.common.hash.HashCode; //導入方法依賴的package包/類
private static void syncRegularFile(final Path sourceFile, final Path targetFile)
throws IOException {
if (Files.exists(targetFile)) {
final HashCode sourceHash = sha256(sourceFile);
final HashCode targetHash = sha256(targetFile);
if (sourceHash.equals(targetHash)) {
return;
}
}
Files.copy(sourceFile, targetFile, StandardCopyOption.REPLACE_EXISTING);
}
示例4: sameHash
import com.google.common.hash.HashCode; //導入方法依賴的package包/類
private boolean sameHash(CompilationFileState previousState, HashCode newHash) {
return previousState != null && newHash.equals(previousState.getHash());
}
示例5: verify
import com.google.common.hash.HashCode; //導入方法依賴的package包/類
/**
* Verifies that the hashes match when both hashes are supplied
* @param me
* @param you
* @return
*/
public boolean verify(final HashCode me, final HashCode you) {
return me == null || you == null || me.equals(you);
}