private static Collection<String> valueAssignableIntersection(final Iterable<ValueAssignable> a, final Iterable<String> b) { List<String> temp = new ArrayList<>(); if (!IterableUtils.isEmpty(a)) { for (ValueAssignable alist : a) { temp.add((String) alist.getValue()); } } return CollectionUtils.intersection(temp, b); }
/** * Add an additional Map to the composite. * * @param map the Map to be added to the composite * @throws IllegalArgumentException if there is a key collision and there is no * MapMutator set to handle it. */ @SuppressWarnings("unchecked") public synchronized void addComposited(final Map<K, V> map) throws IllegalArgumentException { for (int i = composite.length - 1; i >= 0; --i) { final Collection<K> intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet()); if (intersect.size() != 0) { if (this.mutator == null) { throw new IllegalArgumentException("Key collision adding Map to CompositeMap"); } this.mutator.resolveCollision(this, this.composite[i], map, intersect); } } final Map<K, V>[] temp = new Map[this.composite.length + 1]; System.arraycopy(this.composite, 0, temp, 0, this.composite.length); temp[temp.length - 1] = map; this.composite = temp; }
private static Collection intersectIterable(final Iterable a, final Iterable b) { Collection response; if (!IterableUtils.isEmpty(a) && (a instanceof ArrayList) && !IterableUtils.isEmpty(b) && (b instanceof ArrayList)) { //TODO this is a bit of a hack to allow the intersection of two collections of different types. This is primarily //used to facilitate some MVEL execution. We really should be fixing the MVEL to call a method that retrieves //a list of Strings, rather than a list of ValueAssignables. Object aVal = ((ArrayList) a).get(0); Object bVal = ((ArrayList) b).get(0); if (aVal instanceof ValueAssignable && bVal instanceof String) { response = valueAssignableIntersection(a, b); } else { response = CollectionUtils.intersection(a, b); } } else { response = CollectionUtils.intersection(a, b); } return response; }
public static Collection<String> intersection(final String a, final Iterable<String> b) { List<String> temp = new ArrayList<>(); temp.add(a); return CollectionUtils.intersection(temp, b); }
/** * Add a Set to this composite. * * @param set the set to add * @throws IllegalArgumentException if a SetMutator is set, but fails to resolve a collision * @throws UnsupportedOperationException if there is no SetMutator set * @throws NullPointerException if {@code set} is null * @see SetMutator */ public synchronized void addComposited(final Set<E> set) { for (final Set<E> existingSet : getSets()) { final Collection<E> intersects = CollectionUtils.intersection(existingSet, set); if (intersects.size() > 0) { if (this.mutator == null) { throw new UnsupportedOperationException( "Collision adding composited set with no SetMutator set"); } getMutator().resolveCollision(this, existingSet, set, intersects); if (CollectionUtils.intersection(existingSet, set).size() > 0) { throw new IllegalArgumentException( "Attempt to add illegal entry unresolved by SetMutator.resolveCollision()"); } } } all.add(set); }
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; } }
CollectionUtils.intersection( columnfamilies, includeCFFilter);
(ArrayList<String>) CollectionUtils.intersection(metaFileList, remoteListing); result.filesMatched = filesMatched.size(); result.filesInMetaOnly = metaFileList;
public static Collection<String> valueAssignableIntersection(final Iterable<ValueAssignable> a, final Iterable<String> b) { List<String> temp = new ArrayList<>(); if (!IterableUtils.isEmpty(a)) { for (ValueAssignable alist : a) { temp.add((String) alist.getValue()); } } return CollectionUtils.intersection(temp, b); }
public static Collection intersection(final Iterable a, final Iterable b) { Collection response; if (!IterableUtils.isEmpty(a) && (a instanceof ArrayList) && !IterableUtils.isEmpty(b) && (b instanceof ArrayList)) { //TODO this is a bit of a hack to allow the intersection of two collections of different types. This is primarily //used to facilitate some MVEL execution. We really should be fixing the MVEL to call a method that retrieves //a list of Strings, rather than a list of ValueAssignables. Object aVal = ((ArrayList) a).get(0); Object bVal = ((ArrayList) b).get(0); if (aVal instanceof ValueAssignable && bVal instanceof String) { response = valueAssignableIntersection(a, b); } else { response = CollectionUtils.intersection(a, b); } } else { if (a == null || b == null) { return CollectionUtils.emptyCollection(); } response = CollectionUtils.intersection(a, b); } return response; }
/** * Returns a {@link Collection} containing the intersection 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 intersection of the two collections */ public <E> Collection<E> intersection(Collection<E> a, Collection<E> b) { if (a == null) { return b; } else if (b == null) { return a; } return CollectionUtils.intersection(a, b); }
void addToKnown(ItemPath path, List<? extends PrismValue> values, ObjectFilter filter) { Map.Entry<ItemPath, Collection<? extends PrismValue>> entry = getKnownComponent(path); if (entry != null) { entry.setValue(CollectionUtils.intersection(entry.getValue(), values)); } else { knownComponents.put(path, values); } Map.Entry<ItemPath, Collection<ObjectFilter>> entryFilter = getKnownComponentFilter(path); if (entryFilter != null) { entryFilter.getValue().add(filter); } else { knownComponentFilters.put(path, new ArrayList<>(singletonList(filter))); } }
this.results = new ArrayList<>(CollectionUtils.intersection(this.results, tmpResult));
this.results = new ArrayList<>(CollectionUtils.intersection(this.results, tmpResult));
for (FormSection section : this.sections) { Collection<String> categoriesInCommon = CollectionUtils.intersection(section.getCategories(), categories); if (!categoriesInCommon.isEmpty()) { for (String categoryId : categoriesInCommon) {
for (FormSection section : this.sections) { Collection<String> categoriesInCommon = CollectionUtils.intersection(section.getCategories(), categories); if (!categoriesInCommon.isEmpty()) { for (String categoryId : categoriesInCommon) {
@Override public boolean isEventMatching(WatchListEvent event, String subscriber) { boolean isWatched = false; try { // The subscriber's watched users, since each event can be a composite event. Collection<String> watchedUsers = store.getWatchedElements(subscriber, WatchedElementType.USER); isWatched |= store.isWatched(event.getWiki(), subscriber, WatchedElementType.WIKI); isWatched |= store.isWatched(event.getPrefixedSpace(), subscriber, WatchedElementType.SPACE); isWatched |= store.isWatched(event.getPrefixedFullName(), subscriber, WatchedElementType.DOCUMENT); isWatched |= CollectionUtils.intersection(watchedUsers, event.getAuthors()).size() > 0; } catch (Exception e) { logger.error("Failed to determine if an event for the document [{}] is interesting to [{}]", event.getDocumentReference(), subscriber, e); } return isWatched; }
private void consistBatch(String interfaze, List<ApplicationEntity> remoteList) throws Exception { List<ApplicationEntity> localList = cacheContainer.getConnectionCacheEntity().getApplicationEntityList(interfaze); if (!CollectionUtils.isEqualCollection(localList, remoteList)) { List<ApplicationEntity> intersectedList = (List<ApplicationEntity>) CollectionUtils.intersection(localList, remoteList); List<ApplicationEntity> onlineList = (List<ApplicationEntity>) CollectionUtils.subtract(remoteList, intersectedList); List<ApplicationEntity> offlineList = (List<ApplicationEntity>) CollectionUtils.subtract(localList, intersectedList); consistBatchClient(interfaze, onlineList, true); consistBatchClient(interfaze, offlineList, false); } }
Collection intersection = CollectionUtils.intersection(destinationPropertyStudyEventDefinitions, targetStudyEventDefinitions); if (intersection.size() == 0) { e.rejectValue(p + "oid", "oid.invalid", "OID: " + propertyBean.getOid() + " is Invalid.");
Collection intersection = CollectionUtils.intersection(destinationPropertyStudyEventDefinitions, targetStudyEventDefinitions); if (intersection.size() == 0) { e.rejectValue(p + "oid", "oid.invalid", "OID: " + propertyBean.getOid() + " is Invalid.");