本文整理汇总了Java中com.google.common.collect.Sets.symmetricDifference方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.symmetricDifference方法的具体用法?Java Sets.symmetricDifference怎么用?Java Sets.symmetricDifference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.symmetricDifference方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static SystemOutputStore2016 open(File dir) throws IOException {
final Symbol systemID = Symbol.from(dir.getName());
final File argumentsDir = new File(dir, "arguments");
final File linkingDir = new File(dir, "linking");
final File corpusLinkingFile = new File(new File(dir, "corpusLinking"), "corpusLinking");
corpusLinkingFile.getParentFile().mkdirs();
final ArgumentStore argStore = AssessmentSpecFormats.openSystemOutputStore(argumentsDir,
AssessmentSpecFormats.Format.KBP2015);
final LinkingStore linkingStore =
LinkingStoreSource.createFor2016().openLinkingStore(linkingDir);
if (argStore.docIDs().equals(linkingStore.docIDs())) {
return new SystemOutputStore2016(systemID, argStore, linkingStore, corpusLinkingFile);
} else {
throw new RuntimeException("Argument and linking store docIDs do not match, missing " + Sets
.symmetricDifference(argStore.docIDs(), linkingStore.docIDs()));
}
}
示例2: openOrCreate
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static SystemOutputStore2016 openOrCreate(File dir) throws IOException {
final Symbol systemID = Symbol.from(dir.getName());
final File argumentsDir = new File(dir, "arguments");
final File linkingDir = new File(dir, "linking");
final File corpusLinkingFile = new File(new File(dir, "corpusLinking"), "corpusLinking");
corpusLinkingFile.getParentFile().mkdirs();
final ArgumentStore argStore = AssessmentSpecFormats.openOrCreateSystemOutputStore(argumentsDir,
AssessmentSpecFormats.Format.KBP2015);
final LinkingStore linkingStore =
LinkingStoreSource.createFor2016().openOrCreateLinkingStore(linkingDir);
if (argStore.docIDs().equals(linkingStore.docIDs())) {
return new SystemOutputStore2016(systemID, argStore, linkingStore, corpusLinkingFile);
} else {
throw new RuntimeException("Argument and linking store docIDs do not match, missing " + Sets
.symmetricDifference(argStore.docIDs(), linkingStore.docIDs()));
}
}
示例3: bevatParentobjectGroepenMetRecordsZonderIndMutLev
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private boolean bevatParentobjectGroepenMetRecordsZonderIndMutLev(final MetaRecord metaRecord) {
final MetaObject parentObject = metaRecord.getParentGroep().getParentObject();
final Set<MetaGroep> overigeGroepen = Sets.symmetricDifference(parentObject.getGroepen(), Sets.newHashSet(metaRecord.getParentGroep()));
for (final MetaGroep metaGroep : overigeGroepen) {
for (final MetaRecord record : metaGroep.getRecords()) {
if (record.isIndicatieTbvLeveringMutaties() == null || !record.isIndicatieTbvLeveringMutaties()) {
return true;
}
}
}
return false;
}
示例4: diff
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static List<Set<String>> diff(HeaderGroup expected, HeaderGroup actual) {
Set<String> expecetdKeys = keys(expected);
Set<String> actualKeys = keys(actual);
Set<String> common = Sets.intersection(expecetdKeys, actualKeys);
Set<String> symdiff = Sets.symmetricDifference(expecetdKeys, actualKeys);
Set<String> diffval = new HashSet<>();
for (String s : common)
if (! expected.getCondensedHeader(s).getValue().equals(actual.getCondensedHeader(s).getValue())) diffval.add(s);
return Arrays.asList(diffval, symdiff);
}
示例5: disjointView
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* set1, set2的补集(在set1或set2中,但不在交集中的对象,又叫反交集)的只读view,不复制产生新的Set对象.
*
* 如果尝试写入该View会抛出UnsupportedOperationException
*/
public static <E> Set<E> disjointView(final Set<? extends E> set1, final Set<? extends E> set2) {
return Sets.symmetricDifference(set1, set2);
}