本文整理了Java中org.apache.commons.collections4.CollectionUtils.containsAny()
方法的一些代码示例,展示了CollectionUtils.containsAny()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CollectionUtils.containsAny()
方法的具体详情如下:
包路径:org.apache.commons.collections4.CollectionUtils
类名称:CollectionUtils
方法名:containsAny
[英]Returns true
iff at least one element is in both collections.
In other words, this method returns true
iff the #intersection of coll1 and coll2 is not empty.
[中]如果两个集合中至少有一个元素,则返回true
。
换句话说,如果coll1和coll2的#交集不为空,此方法返回true
。
代码示例来源:origin: DV8FromTheWorld/JDA
private boolean isRoleMentioned(IMentionable mentionable)
{
if (mentionable instanceof Role)
{
return getMentionedRoles().contains(mentionable);
}
else if (mentionable instanceof Member)
{
final Member member = (Member) mentionable;
return CollectionUtils.containsAny(getMentionedRoles(), member.getRoles());
}
else if (isFromType(ChannelType.TEXT) && mentionable instanceof User)
{
final Member member = getGuild().getMember((User) mentionable);
return member != null && CollectionUtils.containsAny(getMentionedRoles(), member.getRoles());
}
return false;
}
代码示例来源:origin: DV8FromTheWorld/JDA
if (!CollectionUtils.containsAny(gameJson.keySet(), richGameFields))
return new Game(name, url, type, timestamps);
代码示例来源:origin: org.opensingular/singular-form-wicket
public boolean hasUpdatedType(Set<String> typeNames) {
return CollectionUtils.containsAny(this.typesName, typeNames);
}
}
代码示例来源:origin: DV8FromTheWorld/JDA
|| CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles()));
代码示例来源:origin: gradle.plugin.com.s390x/gogradle
public static boolean containsAny(final Collection<?> coll1, final Collection<?> coll2) {
return org.apache.commons.collections4.CollectionUtils.containsAny(coll1, coll2);
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
protected boolean boolVote(User user) {
return (CollectionUtils.containsAny(roles, user.getAllRoles()));
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public boolean hasAccess(User user) {
Collection<String> userRoles = user.getAllRoles();
if (roles.isEmpty() || userRoles.contains(this.superuserRole) || CollectionUtils.containsAny(userRoles, roles)) {
return true;
}
return false;
}
代码示例来源:origin: CloudSlang/cloud-slang
private boolean isAffectedTestCase(SlangTestCase slangTestCase, Set<String> changedExecutables,
Map<String, Executable> allTestedFlowModels) {
String testFlowPath = slangTestCase.getTestFlowPath();
Executable testCaseReference = allTestedFlowModels.get(testFlowPath);
if (testCaseReference == null) {
throw new RuntimeException("Test case reference[" + testFlowPath + "] not found in compiled models.");
}
Set<String> testCaseDependencies = dependenciesHelper.fetchDependencies(testCaseReference, allTestedFlowModels);
testCaseDependencies.add(testFlowPath);
return containsAny(testCaseDependencies, changedExecutables);
}
代码示例来源:origin: CloudSlang/cloud-slang
public boolean isTestCaseInActiveSuite(SlangTestCase testCase, List<String> testSuites) {
return (isEmpty(testCase.getTestSuites()) && testSuites.contains(SlangBuildMain.DEFAULT_TESTS)) ||
containsAny(testSuites, testCase.getTestSuites());
}
代码示例来源:origin: info.magnolia/magnolia-templating
protected String resolveAvailableComponents() {
if (StringUtils.isNotEmpty(availableComponents)) {
return StringUtils.remove(availableComponents, " ");
}
if (areaDefinition != null && areaDefinition.getAvailableComponents().size() > 0) {
Iterator<ComponentAvailability> iterator = areaDefinition.getAvailableComponents().values().iterator();
List<String> componentIds = new ArrayList<String>();
final Collection<String> userRoles = MgnlContext.getUser().getAllRoles();
while (iterator.hasNext()) {
ComponentAvailability availableComponent = iterator.next();
if (availableComponent.isEnabled()) {
// check roles
final Collection<String> roles = availableComponent.getRoles();
if (!roles.isEmpty()) {
if (CollectionUtils.containsAny(userRoles, roles)) {
componentIds.add(availableComponent.getId());
}
} else {
componentIds.add(availableComponent.getId());
}
}
}
return StringUtils.join(componentIds, ',');
}
return "";
}
代码示例来源:origin: ontopia/ontopia
/**
* PUBLIC: Tests whether two topics should be merged or not,
* according to XTM rules.
*
* @param t1 topicIF; #1 topic to merge
* @param t2 topicIF; #2 topic to merge
* @return boolean; true if the topics should be merged, false otherwise.
*/
public static boolean shouldMerge(TopicIF t1, TopicIF t2) {
// check subject locators
if (CollectionUtils.containsAny(t1.getSubjectLocators(), t2.getSubjectLocators()))
return true;
// check subject indicators and source locators
if (CollectionUtils.containsAny(t1.getSubjectIdentifiers(), t2.getSubjectIdentifiers()) ||
CollectionUtils.containsAny(t1.getItemIdentifiers(), t2.getSubjectIdentifiers()))
return true;
if (CollectionUtils.containsAny(t1.getItemIdentifiers(), t2.getItemIdentifiers()) ||
CollectionUtils.containsAny(t1.getSubjectIdentifiers(), t2.getItemIdentifiers()))
return true;
// should merge if they reify the same object
ReifiableIF r1 = t1.getReified();
ReifiableIF r2 = t2.getReified();
if (r1 != null && Objects.equals(r1, r2))
return true;
return false;
}
代码示例来源:origin: info.magnolia/magnolia-module-standard-templating-kit
if (!CollectionUtils.containsAny(MgnlContext.getUser().getAllRoles(), roles)) {
return false;
代码示例来源:origin: info.magnolia.site/magnolia-site
final Collection<String> roles = templateConfig.getRoles();
if (!roles.isEmpty()) {
if (!CollectionUtils.containsAny(MgnlContext.getUser().getAllRoles(), roles)) {
return false;
代码示例来源:origin: org.ligoj.plugin/plugin-id
/**
* Return groups matching to given criteria. The visible groups, trees and companies are checked. The returned
* groups of each user depends on the groups the user can see/write in CN form.
*
* @param uriInfo
* filter data.
* @return found groups.
*/
@GET
public TableItem<ContainerCountVo> findAll(@Context final UriInfo uriInfo) {
final List<ContainerScope> types = containerScopeResource.findAllDescOrder(ContainerType.GROUP);
final Map<String, CompanyOrg> companies = getCompany().findAll();
final Collection<CompanyOrg> visibleCompanies = organizationResource.getContainers();
final Set<GroupOrg> writeGroups = getContainersForWrite();
final Set<GroupOrg> adminGroups = getContainersForAdmin();
final Map<String, UserOrg> users = getUser().findAll();
// Search the groups
final Page<GroupOrg> findAll = getContainers(DataTableAttributes.getSearch(uriInfo),
paginationJson.getPageRequest(uriInfo, ORDERED_COLUMNS));
// Apply pagination and secure the users data
return paginationJson.applyPagination(uriInfo, findAll, rawGroup -> {
final ContainerCountVo securedUserOrg = newContainerCountVo(rawGroup, writeGroups, adminGroups, types);
securedUserOrg.setCount(rawGroup.getMembers().size());
// Computed the visible members
securedUserOrg.setCountVisible((int) rawGroup.getMembers().stream().map(users::get).map(UserOrg::getCompany)
.map(companies::get).map(CompanyOrg::getCompanyTree)
.filter(c -> CollectionUtils.containsAny(visibleCompanies, c)).count());
return securedUserOrg;
});
}
内容来源于网络,如有侵权,请联系作者删除!