public void testUnion() { Collection col = CollectionUtils.union(collectionA,collectionB); Map freq = CollectionUtils.getCardinalityMap(col); assertEquals(new Integer(1),freq.get("a")); assertEquals(new Integer(4),freq.get("b")); assertEquals(new Integer(3),freq.get("c")); assertEquals(new Integer(4),freq.get("d")); assertEquals(new Integer(1),freq.get("e")); Collection col2 = CollectionUtils.union(collectionB,collectionA); Map freq2 = CollectionUtils.getCardinalityMap(col2); assertEquals(new Integer(1),freq2.get("a")); assertEquals(new Integer(4),freq2.get("b")); assertEquals(new Integer(3),freq2.get("c")); assertEquals(new Integer(4),freq2.get("d")); assertEquals(new Integer(1),freq2.get("e")); }
public void testDisjunctionAsUnionMinusIntersection() { Collection dis = CollectionUtils.disjunction(collectionA,collectionB); Collection un = CollectionUtils.union(collectionA,collectionB); Collection inter = CollectionUtils.intersection(collectionA,collectionB); assertTrue(CollectionUtils.isEqualCollection(dis,CollectionUtils.subtract(un,inter))); }
public void testDisjunctionAsSymmetricDifference() { Collection dis = CollectionUtils.disjunction(collectionA,collectionB); Collection amb = CollectionUtils.subtract(collectionA,collectionB); Collection bma = CollectionUtils.subtract(collectionB,collectionA); assertTrue(CollectionUtils.isEqualCollection(dis,CollectionUtils.union(amb,bma))); }
/** * Returns the union of both collections into a single collection. * @param first * @param second * @return CollectionUtils.union(first, second) */ public static Collection union( final Collection first, final Collection second) { return CollectionUtils.union(first, second); }
private void initializeMapOfInteractionScores(Map<String, Integer> scoresA, Map<String, Integer> scoresB){ Set<String> existingScores = new HashSet(CollectionUtils.union(scoresA.keySet(), scoresB.keySet())); for (String score : existingScores){ Integer numberA = scoresA.get(score) != null ? scoresA.get(score) : 0; Integer numberB = scoresB.get(score) != null ? scoresB.get(score) : 0; ComparativeValues comparison = new ComparativeValues(numberA, numberB); this.interactionScores.put(score, comparison); } }
@SuppressWarnings("unchecked") @Override public PowerList<E> getUnion(Collection<E> list) { return powerList(CollectionUtils.union(this, list)); }
@SuppressWarnings("unchecked") public PowerSet<E> getUnion(Collection<E> Set) { return powerSet(CollectionUtils.union(this, Set)); }
private Collection<FieldIndexer> init() { final Collection<FieldIndexer> answer = new HashSet<FieldIndexer>(); final Collection<IssueSearcher<?>> allSearchers = searcherManager.getAllSearchers(); for (final IssueSearcher<?> searcher : allSearchers) { answer.addAll(searcher.getSearchInformation().getRelatedIndexers()); } return CollectionUtils.union(knownIndexers, answer); }
Set<Item> currentItemSet = new LinkedHashSet<Item>(); currentItemSet.addAll( CollectionUtils.union( firstItemSet, itemSet ) );
/** * <p>Retorna todas as tarefas definidas neste mapa.</p> * * @return todas as tarefas definidas. */ public Collection<MTask<?>> getAllTasks() { return CollectionUtils.union(getTasks(), getEndTasks()); }
private ProcessContext createProcessContext(final String pid, final Map<String, Serializable> auxParams, final ApplicationContext ctx) { Map<String, Serializable> params = new HashMap<String, Serializable>(); @SuppressWarnings("unchecked") final Map<String, ProcessPropertiesContainer> map = ctx.getBeansOfType(ProcessPropertiesContainer.class); if (map.size() > 0) { final ProcessPropertiesContainer propContainer = map.values().iterator().next(); if (auxParams != null) { @SuppressWarnings("unchecked") final Collection<String> keys = CollectionUtils.union(auxParams.keySet(), propContainer.keySet()); for (final String key : keys) { if (auxParams.containsKey(key)) { params.put(key, auxParams.get(key)); } else { params.put(key, propContainer.get(key)); } } } else { params = propContainer; } } else { params = auxParams; } return new ProcessContext(pid, params); }
@Override public Map<QName, Integer> diff(EvaluationOrder newState) { if (!newState.isDefined()) { throw new IllegalArgumentException("Cannot compute diff to undefined evaluation order"); } @SuppressWarnings({"unchecked", "raw"}) Collection<QName> relations = CollectionUtils.union(getRelations(), newState.getRelations()); Map<QName, Integer> rv = new HashMap<>(); // relation is not null below relations.forEach(relation -> rv.put(relation, newState.getMatchingRelationOrder(relation) - getMatchingRelationOrder(relation))); return rv; }
(context == null) ? phrases : CollectionUtils.union(phrases, context));
props.put( "ignoredResources", CollectionUtils.union( env.excludes("duplicatefinder"), Arrays.asList("META-INF/.*", "module-info.class")
(context == null) ? phrases : CollectionUtils.union(phrases, context));
List<AtlasVertex> classificationVerticesUnion = (List<AtlasVertex>) CollectionUtils.union(currentClassificationVertices, updatedClassificationVertices); Map<AtlasVertex, List<AtlasVertex>> updatedClassificationsMap = graphHelper.getClassificationPropagatedEntitiesMapping(classificationVerticesUnion);
List<AtlasVertex> classificationVerticesUnion = (List<AtlasVertex>) CollectionUtils.union(currentClassificationVertices, updatedClassificationVertices); Map<AtlasVertex, List<AtlasVertex>> updatedClassificationsMap = graphHelper.getClassificationPropagatedEntitiesMapping(classificationVerticesUnion);
.query(queryRoot) .mutation(mutationRoot) .build(new HashSet<>(CollectionUtils.union( connectionObjectRegistry.values(), inputObjectRegistry.values()
.query(queryRoot) .mutation(mutationRoot) .build(new HashSet<>(CollectionUtils.union( connectionObjectRegistry.values(), inputObjectRegistry.values()
final FatalityExceptionAdapter aggregatedAdapter = new AggregatedFatalityExceptionAdapter(); @SuppressWarnings("unchecked") final Collection<FatalityExceptionAdapter> adapters = CollectionUtils.union(mapParent.values(), mapChild.values()); ((AggregatedFatalityExceptionAdapter) aggregatedAdapter).setAdapters(adapters); entry.setFatalityAdapter(aggregatedAdapter);