本文整理了Java中org.apache.commons.collections4.CollectionUtils.union()
方法的一些代码示例,展示了CollectionUtils.union()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CollectionUtils.union()
方法的具体详情如下:
包路径:org.apache.commons.collections4.CollectionUtils
类名称:CollectionUtils
方法名:union
[英]Returns a Collection containing the union of the given Iterables.
The cardinality of each element in the returned Collection will be equal to the maximum of the cardinality of that element in the two given Iterables.
[中]返回包含给定Iterables的并集的集合。
返回集合中每个元素的基数将等于该元素在两个给定ITerable中的最大基数。
代码示例来源:origin: gocd/gocd
@Deprecated
public Collection<MaterialRevision> computeRevisionsForReporting(CaseInsensitiveString pipelineName, PipelineTimeline pipelineTimeline) {
Pair<List<RootFanInNode>, List<DependencyFanInNode>> scmAndDepMaterialsChildren = getScmAndDepMaterialsChildren();
List<RootFanInNode> scmChildren = scmAndDepMaterialsChildren.first();
List<DependencyFanInNode> depChildren = scmAndDepMaterialsChildren.last();
if (depChildren.isEmpty()) {
//No fanin required all are SCMs
return null;
}
FanInGraphContext context = buildContext(pipelineTimeline);
root.initialize(context);
initChildren(depChildren, pipelineName, context);
iterateAndMakeAllUniqueScmRevisionsForChildrenSame(depChildren, pipelineName, context);
List<MaterialRevision> finalRevisionsForScmChildren = createFinalRevisionsForScmChildren(root.latestPipelineTimelineEntry(context), scmChildren, depChildren);
List<MaterialRevision> finalRevisionsForDepChildren = createFinalRevisionsForDepChildren(depChildren);
return CollectionUtils.union(finalRevisionsForScmChildren, finalRevisionsForDepChildren);
}
代码示例来源:origin: gocd/gocd
public MaterialRevisions computeRevisions(MaterialRevisions actualRevisions, PipelineTimeline pipelineTimeline) {
assertAllDirectDependenciesArePresentInInput(actualRevisions, pipelineName);
Pair<List<RootFanInNode>, List<DependencyFanInNode>> scmAndDepMaterialsChildren = getScmAndDepMaterialsChildren();
List<RootFanInNode> scmChildren = scmAndDepMaterialsChildren.first();
List<DependencyFanInNode> depChildren = scmAndDepMaterialsChildren.last();
if (depChildren.isEmpty()) {
//No fanin required all are SCMs
return actualRevisions;
}
FanInGraphContext context = buildContext(pipelineTimeline);
root.initialize(context);
initChildren(depChildren, pipelineName, context);
if (fanInEventListener != null) {
fanInEventListener.iterationComplete(0, depChildren);
}
iterateAndMakeAllUniqueScmRevisionsForChildrenSame(depChildren, pipelineName, context);
List<MaterialRevision> finalRevisionsForScmChildren = createFinalRevisionsForScmChildren(root.latestPipelineTimelineEntry(context), scmChildren, depChildren);
List<MaterialRevision> finalRevisionsForDepChildren = createFinalRevisionsForDepChildren(depChildren);
return new MaterialRevisions(CollectionUtils.union(getMaterialsFromCurrentPipeline(finalRevisionsForScmChildren, actualRevisions), finalRevisionsForDepChildren));
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-velocity
/**
* Returns a {@link Collection} containing the union 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 union of the two collections
*/
public <E> Collection<E> union(Collection<E> a, Collection<E> b)
{
if (a == null) {
return b;
} else if (b == null) {
return a;
}
return CollectionUtils.union(a, b);
}
代码示例来源:origin: alien4cloud/alien4cloud
private Collection<? extends String> getEnvironmentTypeTopLevelVariables(String applicationId, String topologyVersion) {
applicationService.checkAndGetApplication(applicationId);
return Arrays.stream(EnvironmentType.values())
.map(environmentType -> editorFileService.loadEnvironmentTypeVariables(Csar.createId(applicationId, topologyVersion), environmentType).keySet())
.reduce(Sets.newHashSet(), (set, anotherSet) -> Sets.newHashSet(CollectionUtils.union(set, anotherSet)));
}
代码示例来源:origin: alien4cloud/alien4cloud
private Collection<? extends String> getEnvironmentTopLevelVariables(String applicationId, String topologyVersion) {
applicationService.checkAndGetApplication(applicationId);
return Arrays.stream(applicationEnvironmentService.getAuthorizedByApplicationId(applicationId))
.map(env -> editorFileService.loadEnvironmentVariables(Csar.createId(applicationId, topologyVersion), env.getId()).keySet())
.reduce(Sets.newHashSet(), (set, anotherSet) -> Sets.newHashSet(CollectionUtils.union(set, anotherSet)));
}
代码示例来源:origin: yahoo/elide
UpdatePermission.class,
collectionName,
CollectionUtils.union(CollectionUtils.emptyIfNull(collection), singleton),
original);
if (collection == null) {
代码示例来源:origin: com.yahoo.elide/elide-core
UpdatePermission.class,
collectionName,
CollectionUtils.union(CollectionUtils.emptyIfNull(collection), singleton),
original);
if (collection == null) {
内容来源于网络,如有侵权,请联系作者删除!