/** * 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. */ public synchronized void addComposited(Map map) throws IllegalArgumentException { for (int i = composite.length - 1; i >= 0; --i) { Collection 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"); } else { this.mutator.resolveCollision(this, this.composite[i], map, intersect); } } } Map[] 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 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); }
/** * 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. */ public synchronized void addComposited(Map map) throws IllegalArgumentException { for (int i = composite.length - 1; i >= 0; --i) { Collection 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"); } else { this.mutator.resolveCollision(this, this.composite[i], map, intersect); } } } Map[] 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; }
Collection intersects = CollectionUtils.intersection(set, c); if (intersects.size() > 0) { if (this.mutator == null) { if (CollectionUtils.intersection(set, c).size() > 0) { throw new IllegalArgumentException( "Attempt to add illegal entry unresolved by SetMutator.resolveCollision()");
Collection intersects = CollectionUtils.intersection(set, c); if (intersects.size() > 0) { if (this.mutator == null) { if (CollectionUtils.intersection(set, c).size() > 0) { throw new IllegalArgumentException( "Attempt to add illegal entry unresolved by SetMutator.resolveCollision()");
public List<IpAddress> updatedIPs(Collection<IpAddress> a, Collection<IpAddress> b) { List<IpAddress> intersects = (List<IpAddress>) CollectionUtils.intersection(a, b); Map<String, IpAddress> stringIPAddressMap = new ConcurrentHashMap<>(intersects.size());
public void testIntersection() { Collection col = CollectionUtils.intersection(collectionA,collectionB); Map freq = CollectionUtils.getCardinalityMap(col); assertNull(freq.get("a")); assertEquals(new Integer(2),freq.get("b")); assertEquals(new Integer(3),freq.get("c")); assertEquals(new Integer(2),freq.get("d")); assertNull(freq.get("e")); Collection col2 = CollectionUtils.intersection(collectionB,collectionA); Map freq2 = CollectionUtils.getCardinalityMap(col2); assertNull(freq2.get("a")); assertEquals(new Integer(2),freq2.get("b")); assertEquals(new Integer(3),freq2.get("c")); assertEquals(new Integer(2),freq2.get("d")); assertNull(freq2.get("e")); }
+ ensureOrder(CollectionUtils.intersection(mandatoryDims, hierarchyDims))); + ensureOrder(CollectionUtils.intersection(mandatoryDims, jointDims))); throw new IllegalStateException( "Aggregation group " + index + " hierarchy dimensions overlap with joint dimensions: " + ensureOrder(CollectionUtils.intersection(hierarchyDims, jointDims)));
for (String[] oneHierarchy : agg.getSelectRule().hierarchyDims) { Set<String> share = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); share.addAll(CollectionUtils.intersection(oneJoint, Arrays.asList(oneHierarchy))); overlap.addAll(CollectionUtils.intersection(existing, oneJoint));
Collection intersection = CollectionUtils.intersection(cola,colb); assertEquals(1,intersection.size());
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 testIsProperSubCollection() { Collection a = new ArrayList(); Collection b = new ArrayList(); assertTrue(!CollectionUtils.isProperSubCollection(a,b)); b.add("1"); assertTrue(CollectionUtils.isProperSubCollection(a,b)); assertTrue(!CollectionUtils.isProperSubCollection(b,a)); assertTrue(!CollectionUtils.isProperSubCollection(b,b)); assertTrue(!CollectionUtils.isProperSubCollection(a,a)); a.add("1"); a.add("2"); b.add("2"); assertTrue(!CollectionUtils.isProperSubCollection(b,a)); assertTrue(!CollectionUtils.isProperSubCollection(a,b)); a.add("1"); assertTrue(CollectionUtils.isProperSubCollection(b,a)); assertTrue(CollectionUtils.isProperSubCollection( CollectionUtils.intersection(collectionA, collectionB), collectionA)); assertTrue(CollectionUtils.isProperSubCollection( CollectionUtils.subtract(a, b), a)); assertTrue(!CollectionUtils.isProperSubCollection( a, CollectionUtils.subtract(a, b))); }
final Collection<String> edgeKeySet = getEdgeKeysAndNormalizeIfRequired(identifiedEdgeKeyTypes); intersection = CollectionUtils.intersection(vertexKeySet, edgeKeySet);
@Override public T build(ValueResolvingContext context) throws MuleException { if (!lazyInitEnabled) { Collection<String> definedExclusiveParameters = intersection(exclusiveOptionalsTypeAnnotation.getExclusiveParameterNames(), resolvers.keySet().stream().map(fs -> getAlias(fs.getField())).collect(toSet())); if (definedExclusiveParameters.isEmpty() && exclusiveOptionalsTypeAnnotation.isOneRequired()) { throw new ConfigurationException((createStaticMessage(format( "Parameter group of type '%s' requires that one of its optional parameters should be set but all of them are missing. " + "One of the following should be set: [%s]", prototypeClass.getName(), on(", ").join(exclusiveOptionalsTypeAnnotation .getExclusiveParameterNames()))))); } else if (definedExclusiveParameters.size() > 1) { throw new ConfigurationException( createStaticMessage(format("In Parameter group of type '%s', the following parameters cannot be set at the same time: [%s]", prototypeClass.getName(), on(", ").join(definedExclusiveParameters)))); } } return super.build(context); }
for (ParameterGroupModel group : groups) { for (ExclusiveParametersModel exclusiveModel : group.getExclusiveParametersModels()) { Collection<String> definedExclusiveParameters = intersection(exclusiveModel.getExclusiveParameterNames(), resolverKeys); if (definedExclusiveParameters.isEmpty() && exclusiveModel.isOneRequired()) { throw new ConfigurationException((createStaticMessage(format(
public boolean equals(final Object o) { if (this == o) { return true; } if ((o == null) || (getClass() != o.getClass())) { return false; } final EnterpriseWorkflowTaskContext that = (EnterpriseWorkflowTaskContext) o; return isNotEmpty(intersection(projectIds, that.projectIds)); }
/** * Check if tow collections contains exactly the same elements. * The order of elements within each collection is not relevant. */ public static boolean equals(Collection o1, Collection o2) { if (o1 == null && o2 != null) return false; else if (o1 != null && o2 == null) return false; else if (o1 == null && o2 == null) return false; else if (o1.size() != o2.size()) return false; else if (o1.isEmpty() && o2.isEmpty()) return false; else return CollectionUtils.intersection(o1, o2).size() == o1.size(); }
@Transactional(value = "jamiTransactionManager", propagation = Propagation.REQUIRED, readOnly = true) public Collection<String> getPublicationsHavingIMExCurationLevelAndUniprotDrExportNo() { if (!isInitialised){ initialise(); } Collection<String> publicationsWithoutImexButImexCurationLevel = CollectionUtils.subtract(publicationsHavingImexCurationLevel, publicationsHavingImexId); return CollectionUtils.intersection(publicationsWithoutImexButImexCurationLevel, publicationsHavingUniprotDRExportNo); }
private Predicate<ServiceAccount> getServiceAccountPredicate(boolean isAdmin, List<String> roleNames) { if (isAdmin) { return svcAcct -> true; } if (fiatRoleConfig.isOrMode()) { return svcAcct -> CollectionUtils.intersection(roleNames, svcAcct.getMemberOf()).size() > 0; } else { return svcAcct -> roleNames.containsAll(svcAcct.getMemberOf()); } }
@Override public boolean test(PhdIndividualProgramProcess toEval) { if (toEval.getPhdProgram() != null) { return getValue().equals(toEval.getPhdProgram()); } else if (toEval.getPhdProgramFocusArea() != null) { return !CollectionUtils.intersection(Collections.singleton(getValue()), toEval.getPhdProgramFocusArea().getPhdProgramsSet()).isEmpty(); } else { return false; } } });