本文整理了Java中org.apache.commons.collections4.CollectionUtils.disjunction()
方法的一些代码示例,展示了CollectionUtils.disjunction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CollectionUtils.disjunction()
方法的具体详情如下:
包路径:org.apache.commons.collections4.CollectionUtils
类名称:CollectionUtils
方法名:disjunction
[英]Returns a Collection containing the exclusive disjunction (symmetric difference) of the given Iterables.
The cardinality of each element e in the returned Collection will be equal to max(cardinality(e,a),cardinality(e,b)) - min(cardinality(e,a), cardinality(e,b))
.
This is equivalent to {@link #subtract subtract}({@link #union union(a,b)},{@link #intersection intersection(a,b)})} or {@link #union union}({@link #subtract subtract(a,b)},{@link #subtract subtract(b,a)})}.
[中]
代码示例来源:origin: ethereum/ethereumj
private Collection<String> getUnresolvedDependencies() {
Set<String> ret = new HashSet<>();
for (SourceArtifact injectedDependency : injectedDependencies) {
ret.add(injectedDependency.getName());
}
return disjunction(dependencies, ret);
}
代码示例来源:origin: gocd/gocd
private void validateIfRevisionMatchesTheCurrentConfigAndUpdateTheMaterialMap(FanInGraphContext context, Pair<StageIdentifier, List<FaninScmMaterial>> stageIdentifierScmPair) {
final Set<MaterialConfig> currentScmMaterials = context.pipelineScmDepMap.get(materialConfig);
final Set<FaninScmMaterial> scmMaterials = new HashSet<>(stageIdentifierScmPair.last());
final Set<String> currentScmFingerprint = new HashSet<>();
for (MaterialConfig currentScmMaterial : currentScmMaterials) {
currentScmFingerprint.add(currentScmMaterial.getFingerprint());
}
final Set<String> scmMaterialsFingerprint = new HashSet<>();
for (FaninScmMaterial scmMaterial : scmMaterials) {
scmMaterialsFingerprint.add(scmMaterial.fingerprint);
}
final Collection commonMaterials = CollectionUtils.intersection(currentScmFingerprint, scmMaterialsFingerprint);
if (commonMaterials.size() == scmMaterials.size() && commonMaterials.size() == currentScmMaterials.size()) {
stageIdentifierScmMaterial.put(stageIdentifierScmPair.first(), scmMaterials);
++currentCount;
} else {
Collection disjunctionWithConfig = CollectionUtils.disjunction(currentScmFingerprint, commonMaterials);
Collection disjunctionWithInstance = CollectionUtils.disjunction(scmMaterialsFingerprint, commonMaterials);
LOGGER.warn("[Fan-in] - Incompatible materials for {}. Config: {}. Instance: {}.", stageIdentifierScmPair.first().getStageLocator(), disjunctionWithConfig, disjunctionWithInstance);
//This is it. We will not go beyond this revision in history
totalInstanceCount = currentCount;
}
}
代码示例来源:origin: pentaho/pentaho-kettle
Collection<Integer> disjunction = CollectionUtils.disjunction( nonEmptyIndexesBeforeChanges, nonEmptyIndexesAfterChanges );
Integer disjunctionIdx = (Integer) disjunction.toArray()[0];
if ( nonEmptyIndexesAfterChanges.contains( disjunctionIdx ) ) {
代码示例来源:origin: org.xwiki.commons/xwiki-commons-velocity
/**
* Returns a {@link Collection} containing the exclusive disjunction (symmetric difference) of the given
* {@link Collection}s.
*
* @param <E> the type of the elements in the collection
* @param a the first collection, must be non-null
* @param b the second collection, must be non-null
* @return the symmetric difference of the two collections
*/
public <E> Collection<E> disjunction(Collection<E> a, Collection<E> b)
{
if (a == null) {
return b;
} else if (b == null) {
return a;
}
return CollectionUtils.disjunction(a, b);
}
代码示例来源:origin: org.opensingular/singular-form-wicket
protected static Map<String, SInstance> collectLowerBoundInstances(FeedbackFence feedbackFence) {
// coleta os componentes descendentes que possuem um handler, e as instancias correspondentes
final Set<Component> mainComponents = collectLowerBoundInstances(feedbackFence.getMainContainer());
final Set<Component> externalComponents = collectLowerBoundInstances(feedbackFence.getExternalContainer());
final Map<String, SInstance> map = new LinkedHashMap<>();
CollectionUtils.disjunction(mainComponents, externalComponents).stream()
.flatMap(it -> resolveRootInstances(it).stream())
.forEachOrdered(it -> map.put(it.getPathFull(), it));
return map;
}
代码示例来源:origin: com.foreach.across.modules/user-module
@Override
public Role defineRole( Role role ) {
Role existing = roleRepository.findByAuthorityIgnoringCase( role.getAuthority() );
if ( existing != null ) {
if ( existing.getPermissions().size() != role.getPermissions().size() ) {
Collection<Permission> difference = CollectionUtils.disjunction( existing.getPermissions(),
role.getPermissions() );
Collection<String> permissionNames = difference.stream().map( Permission::getName ).collect(
Collectors.toList() );
LOG.error(
"Cannot redefine role '{}' because it would loose the permissions: '{}', you should .addPermission() instead",
role,
StringUtils.join( permissionNames, ", " ) );
}
return existing;
}
else {
return roleRepository.save( role );
}
}
代码示例来源:origin: org.ligoj.plugin/plugin-id
/**
* Validate assigned groups, and return corresponding group identifiers. The groups must be visible by the
* principal, and added/removed groups from the user must be writable by the principal.
*
* @param previousGroups
* The current user's groups.used to validate the changes.
* @param desiredGroups
* The groups the principal user has assigned to the user. In this list, there are some read-only groups
* previously assigned to this user. Only the changes are checked.
* @param delegates
* The delegates (read/write) of the principal user.
*/
private void validateAndGroupsCN(final Collection<String> previousGroups, final Collection<String> desiredGroups,
final List<DelegateOrg> delegates) {
// Check visibility of the desired groups
desiredGroups.forEach(g -> getGroup().findByIdExpected(securityHelper.getLogin(), g));
// Check the visible updated groups can be edited by the principal
CollectionUtils.disjunction(desiredGroups, previousGroups).forEach(g -> validateWriteGroup(g, delegates));
}
代码示例来源:origin: yahoo/elide
UpdatePermission.class,
collectionName,
CollectionUtils.disjunction(collection, Collections.singleton(toDelete.getObject())),
original
);
.disjunction(Collections.singleton(this.getObject()), originalBidirectional);
代码示例来源:origin: com.yahoo.elide/elide-core
UpdatePermission.class,
collectionName,
CollectionUtils.disjunction(collection, Collections.singleton(toDelete.getObject())),
original
);
.disjunction(Collections.singleton(this.getObject()), originalBidirectional);
代码示例来源:origin: Evolveum/midpoint
public void execute(DelegateExecution execution) {
if (LOGGER.isTraceEnabled()) {
RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
Set<String> variablesSeen = new HashSet<>();
LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId());
// LOGGER.trace("All variables for execution id={}, parent id={}", execution.getId(), execution.getParentId());
// execution.getVariableInstances().forEach((n, v) -> LOGGER.trace(" - {} = {} (in {})", n, v.getValue(), v.getExecutionId()));
LOGGER.trace("Execution hierarchy for id={}", execution.getId());
LOGGER.trace("------------------------------------");
dumpExecutionVariables(execution.getId(), execution, null, variablesSeen, runtimeService);
Collection<String> disjunction = CollectionUtils.disjunction(variablesSeen, execution.getVariableNames());
if (!disjunction.isEmpty()) {
LOGGER.trace("*** Variables not found in execution tree or 'execution.getVariableNames()': {}", disjunction);
}
LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId() + " END ------------");
}
}
代码示例来源:origin: com.yahoo.elide/elide-core
modified = CollectionUtils.disjunction(
(Collection) relation,
Collections.singleton(removeResource.getObject())
代码示例来源:origin: yahoo/elide
modified = CollectionUtils.disjunction(
(Collection) relation,
Collections.singleton(removeResource.getObject())
内容来源于网络,如有侵权,请联系作者删除!