private Pair<Boolean, Set<String>> hasOverlap(ArrayList<Set<String>> dimsList, Set<String> Dims) { Set<String> existing = new HashSet<>(); Set<String> overlap = new HashSet<>(); for (Set<String> dims : dimsList) { if (CollectionUtils.containsAny(existing, dims)) { overlap.addAll(ensureOrder(CollectionUtils.intersection(existing, dims))); } existing.addAll(dims); } return new Pair<>(overlap.size() > 0, overlap); }
CollectionUtils.containsAny(one,odds)); assertTrue("containsAny({1,3},{1}) should return true.", CollectionUtils.containsAny(odds,one)); assertTrue("containsAny({3},{1,3}) should return true.", CollectionUtils.containsAny(three,odds)); assertTrue("containsAny({1,3},{3}) should return true.", CollectionUtils.containsAny(odds,three)); assertTrue("containsAny({2},{2}) should return true.", CollectionUtils.containsAny(two,two)); assertTrue("containsAny({1,3},{1,3}) should return true.", CollectionUtils.containsAny(odds,odds)); !CollectionUtils.containsAny(two,odds)); assertTrue("containsAny({1,3},{2}) should return false.", !CollectionUtils.containsAny(odds,two)); assertTrue("containsAny({1},{3}) should return false.", !CollectionUtils.containsAny(one,three)); assertTrue("containsAny({3},{1}) should return false.", !CollectionUtils.containsAny(three,one)); assertTrue("containsAny({1,3},{}) should return false.", !CollectionUtils.containsAny(odds,empty)); assertTrue("containsAny({},{1,3}) should return false.", !CollectionUtils.containsAny(empty,odds)); assertTrue("containsAny({},{}) should return false.", !CollectionUtils.containsAny(empty,empty));
if (CollectionUtils.containsAny(mandatoryDims, hierarchyDims)) { logger.warn("Aggregation group " + index + " mandatory dimensions overlap with hierarchy dimensions: " + ensureOrder(CollectionUtils.intersection(mandatoryDims, hierarchyDims))); if (CollectionUtils.containsAny(mandatoryDims, jointDims)) { logger.warn("Aggregation group " + index + " mandatory dimensions overlap with joint dimensions: " + ensureOrder(CollectionUtils.intersection(mandatoryDims, jointDims))); if (CollectionUtils.containsAny(hierarchyDims, jointDims)) { logger.error("Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions"); throw new IllegalStateException(
if (CollectionUtils.containsAny(mandatoryDims, hierarchyDims)) { Set<String> intersection = new HashSet<>(mandatoryDims); intersection.retainAll(hierarchyDims); continue; if (CollectionUtils.containsAny(mandatoryDims, jointDims)) { Set<String> intersection = new HashSet<>(mandatoryDims); intersection.retainAll(jointDims); oneJoint.add(s); if (CollectionUtils.containsAny(existing, oneJoint)) { overlap.addAll(CollectionUtils.intersection(existing, oneJoint));
assertFalse("List of shared memory IDs after server-client interactions should not include IDs created " + "(on Linux): within client-server interactions.", CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions)); if (CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions)) U.sleep(1000); else CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions));
/** * @throws Exception If failed. */ @Test public void testClientThrowsCorrectExceptionUponServerKilling() throws Exception { info("Shared memory IDs before starting server-client interactions: " + IpcSharedMemoryUtils.sharedMemoryIds()); Collection<Integer> shmemIdsWithinInteractions = checkClientThrowsCorrectExceptionUponServerKilling(); Collection<Integer> shmemIdsAfterInteractions = IpcSharedMemoryUtils.sharedMemoryIds(); info("Shared memory IDs created within interaction: " + shmemIdsWithinInteractions); info("Shared memory IDs after server killing and client graceful termination: " + shmemIdsAfterInteractions); assertFalse("List of shared memory IDs after killing server endpoint should not include IDs created " + "within server-client interactions.", CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions)); }
info("Shared memory IDs after killing client endpoint: " + shmemIdsAfterInteractions); if (CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions)) U.sleep(1000); else CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions));
public List<Id> joinPath(Node back) { // Get self path List<Id> path = this.path(); // Get reversed other path List<Id> backPath = back.path(); Collections.reverse(backPath); // Avoid loop in path if (CollectionUtils.containsAny(path, backPath)) { return ImmutableList.of(); } // Append other path behind self path path.addAll(backPath); return path; }
/** * Delete all scopes from clients that are not valid anymore with the new * resource server * * @param newScopes the newly saved scopes * @param oldScopes the scopes from the existing resource server * @param clients the clients of the resource server */ @SuppressWarnings("unchecked") protected void pruneClientScopes(final List<String> newScopes, List<String> oldScopes, Set<Client> clients) { if (!newScopes.containsAll(oldScopes)) { subtract(oldScopes, newScopes); Collection<String> outdatedScopes = subtract(oldScopes, newScopes); LOG.info("Resource server has updated scopes. Will remove all outdated scopes from clients: {}", outdatedScopes); for (Client c : clients) { final List<String> clientScopes = c.getScopes(); if (CollectionUtils.containsAny(clientScopes, outdatedScopes)) { ArrayList<String> prunedScopes = new ArrayList<String>(subtract(clientScopes, outdatedScopes)); LOG.info("Client scopes of client {} were: {}. After pruning (because resourceServer has new scopes): {}", new Object[]{c.getClientId(), c.getScopes(), prunedScopes}); c.setScopes(prunedScopes); } } } }
protected final boolean validateAuths(final Set<String> userAuths, final Set<String> validAuth, final boolean ifValidAuthIsNull) { boolean rtn = ifValidAuthIsNull; if (null != validAuth) { if (null == userAuths) { rtn = validAuth.isEmpty(); } else { rtn = CollectionUtils.containsAny(userAuths, validAuth); } } return rtn; }
public boolean hasConnectionForAny( final Collection<InetSocketAddress> socketAddresses) { synchronized (this.m_socketAddressesToIo) { final Collection<InetSocketAddress> existingAddresses = this.m_socketAddressesToIo.keySet(); return CollectionUtils.containsAny(existingAddresses, socketAddresses); } }
private boolean hasDupeKeys(List<Map<String, PageProperty>> detailMapList, Map<String, PageProperty> details) { final Set<String> incomingKeys = details.keySet(); return detailMapList.stream().anyMatch(existingMap -> containsAny(existingMap.keySet(), incomingKeys)); }
private boolean schemeContainsOptions(final FieldConfigScheme fieldConfigScheme, final Collection<Option> options) { final Set<Option> schemeOptions = new HashSet<Option>(jqlSelectOptionsUtil.getOptionsForScheme(fieldConfigScheme)); return CollectionUtils.containsAny(schemeOptions, options); }
/** * Indicates whether this user can manage the given user group. * * @param userGroup the user group to test. * @return true if the given user group can be managed by this user, false if not. */ public boolean canManage( UserGroup userGroup ) { return userGroup != null && CollectionUtils.containsAny( groups, userGroup.getManagedByGroups() ); }
private boolean matchesOptionsPositive(final FieldConfigScheme fieldConfigScheme, final Set<Option> positiveOps, final Set<Option> negativeOps) { if (positiveOps.isEmpty()) { return false; } final Set<Option> options = new HashSet<Option>(jqlSelectOptionsUtil.getOptionsForScheme(fieldConfigScheme)); //Note that if we can't match a parent, then we can't match any of its children. removeOptions(options, negativeOps); return CollectionUtils.containsAny(options, positiveOps); }
private Pair<Boolean, Set<String>> hasOverlap(ArrayList<Set<String>> dimsList, Set<String> Dims) { Set<String> existing = new HashSet<>(); Set<String> overlap = new HashSet<>(); for (Set<String> dims : dimsList) { if (CollectionUtils.containsAny(existing, dims)) { overlap.addAll(ensureOrder(CollectionUtils.intersection(existing, dims))); } existing.addAll(dims); } return new Pair<>(overlap.size() > 0, overlap); }
@Override public void enhanceMetadata(BxDocument document, YElement metadata, Set<EnhancedField> enhancedFields) { Set<EnhancedField> fieldsToEnhance = getEnhancedFields(); if (! CollectionUtils.containsAny(enhancedFields, fieldsToEnhance)) { if (enhanceMetadata(document, metadata)) { enhancedFields.addAll(fieldsToEnhance); } } } }
private void verifyAddAgainstRemove() { if (CollectionUtils.containsAny(mergedOperations.getTagsToAdd(), mergedOperations.getTagsToRemove())) { throwException("some tag is in the same time added and removed "); } final Set<String> allNewPaths = mergedOperations.getPartsToAdd().keySet(); final Collection<String> allToRemovePaths = mergedOperations.getPartsToRemove(); if (CollectionUtils.containsAny(allNewPaths, allToRemovePaths)) { throwException("some parts are in the same time added and removed "); } }
@Override public void removeExtensions(Collection<String> ext) { if (CollectionUtils.containsAny(target.getExtensionNames(), ext)) { substituteTargetWithCopy(); target.removeExtensions(ext); } }
static private boolean hasStudentStatuteType(final SearchStudentsByDegreeParametersBean searchBean, final Registration registration) { return CollectionUtils.containsAny(searchBean.getStudentStatuteTypes(), registration.getStudent() .getStatutesTypesValidOnAnyExecutionSemesterFor(searchBean.getExecutionYear())); }