List of usage examples for java.util Collection removeAll
boolean removeAll(Collection<?> c);
From source file:org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors.EnforceVariablesVisitor.java
@Override public ILogicalOperator visitProjectOperator(ProjectOperator op, Collection<LogicalVariable> varsToRecover) throws AlgebricksException { varsToRecover.removeAll(op.getVariables()); // Adds all missing variables that should propagates up. op.getVariables().addAll(varsToRecover); return visitsInputs(op, varsToRecover); }
From source file:op.tools.SYSTools.java
public static Collection difference(Collection coll1, Collection coll2) { // http://code.hammerpig.com/find-the-difference-between-two-lists-in-java.html Collection result = union(coll1, coll2); result.removeAll(intersect(coll1, coll2)); return result; }
From source file:br.unb.cic.bionimbuz.services.monitor.MonitoringService.java
@Override public void verifyPlugins() { final Collection<PluginInfo> temp = this.getPeers().values(); // TA FAZENDO A FUNO DO DELETEPEERS <---- VERIFICAR temp.removeAll(this.plugins); for (final PluginInfo plugin : temp) { if (this.cms.getZNodeExist(Path.STATUS.getFullPath(plugin.getId()), new UpdatePeerData(this.cms, this, null))) { this.cms.getData(Path.STATUS.getFullPath(plugin.getId()), new UpdatePeerData(this.cms, this, null)); }//from w ww. ja va2 s .c o m } }
From source file:op.tools.SYSTools.java
public static Collection subtract(Collection coll1, Collection coll2) { // http://code.hammerpig.com/find-the-difference-between-two-lists-in-java.html Collection result = new ArrayList(coll2); result.removeAll(coll1); return result; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.GroupComposite.java
/** * This will be used when adding a new member using add button. It shows a * list of ACOrgUnits on the server.//ww w .j ava2 s .com * * @return selected elements */ private EList<ACOrgUnit> getNewMembers() { // 1. show a list of all AcOrgUnits that are not member of this group // (get list of all AcOrgUnits, remove those who take part in this // 2. return the selected ACOrgunits final Collection<ACOrgUnit> allOrgUnits = new BasicEList<ACOrgUnit>(); final EList<ACOrgUnit> members = new BasicEList<ACOrgUnit>(); try { allOrgUnits.addAll(getAdminBroker().getOrgUnits()); allOrgUnits.removeAll(getAdminBroker().getMembers(group.getId())); if (allOrgUnits.contains(group)) { allOrgUnits.remove(group); } final Object[] result = showDialog(allOrgUnits, Messages.GroupComposite_Select_Member); for (int i = 0; i < result.length; i++) { if (result[i] instanceof ACOrgUnit) { members.add((ACOrgUnit) result[i]); } } } catch (final ESException e) { // ZH Auto-generated catch block e.printStackTrace(); } return members; }
From source file:org.openmrs.web.controller.concept.ConceptProposalFormController.java
/** * The onSubmit function receives the form/command object that was modified by the input form * and saves it to the db//w w w . java 2 s. c om * * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.lang.Object, * org.springframework.validation.BindException) * @should create a single unique synonym and obs for all similar proposals * @should work properly for country locales */ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object obj, BindException errors) throws Exception { HttpSession httpSession = request.getSession(); String view = getFormView(); Locale locale = Context.getLocale(); MessageSourceAccessor msa = getMessageSourceAccessor(); if (Context.isAuthenticated()) { // this concept proposal ConceptProposal cp = (ConceptProposal) obj; // this proposal's final text String finalText = cp.getFinalText(); ConceptService cs = Context.getConceptService(); AlertService alertService = Context.getAlertService(); // find the mapped concept Concept c = null; if (StringUtils.hasText(request.getParameter("conceptId"))) { c = cs.getConcept(Integer.valueOf(request.getParameter("conceptId"))); } Collection<ConceptName> oldNames = null; if (c != null) { oldNames = c.getNames(); } // The users to be alerted of this change Set<User> uniqueProposers = new HashSet<User>(); Locale conceptNameLocale = LocaleUtility.fromSpecification(request.getParameter("conceptNamelocale")); // map the proposal to the concept (creating obs along the way) uniqueProposers.add(cp.getCreator()); cp.setFinalText(finalText); try { cs.mapConceptProposalToConcept(cp, c, conceptNameLocale); } catch (DuplicateConceptNameException e) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "ConceptProposal.save.fail"); return new ModelAndView(new RedirectView(getSuccessView())); } ConceptName newConceptName = null; if (c != null) { Collection<ConceptName> newNames = c.getNames(); newNames.removeAll(oldNames); if (newNames.size() == 1) { newConceptName = newNames.iterator().next(); } } // all of the proposals to map with similar text List<ConceptProposal> allProposals = cs.getConceptProposals(cp.getOriginalText()); //exclude the proposal submitted with the form since it is already handled above if (allProposals.contains(cp)) { allProposals.remove(cp); } //Just mark the rest of the proposals as mapped to avoid duplicate synonyms and obs for (ConceptProposal conceptProposal : allProposals) { if (cp.getState().equals(OpenmrsConstants.CONCEPT_PROPOSAL_REJECT)) { conceptProposal.rejectConceptProposal(); conceptProposal.setComments(cp.getComments()); } else { //the question concept differs, this needs to me handled separately from the form if (conceptProposal.getObsConcept() != null && !conceptProposal.getObsConcept().equals(cp.getObsConcept())) { continue; } uniqueProposers.add(conceptProposal.getCreator()); conceptProposal.setFinalText(cp.getFinalText()); conceptProposal.setState(cp.getState()); conceptProposal.setMappedConcept(c); conceptProposal.setComments(cp.getComments()); if (conceptProposal.getObsConcept() != null) { Obs ob = new Obs(); ob.setEncounter(conceptProposal.getEncounter()); ob.setConcept(conceptProposal.getObsConcept()); ob.setValueCoded(conceptProposal.getMappedConcept()); if (conceptProposal.getState().equals(OpenmrsConstants.CONCEPT_PROPOSAL_SYNONYM) && newConceptName != null) { ob.setValueCodedName(newConceptName); } ob.setCreator(Context.getAuthenticatedUser()); ob.setDateCreated(new Date()); ob.setObsDatetime(conceptProposal.getEncounter().getEncounterDatetime()); ob.setLocation(conceptProposal.getEncounter().getLocation()); ob.setPerson(conceptProposal.getEncounter().getPatient()); cp.setObs(ob); } } cs.saveConceptProposal(conceptProposal); } String msg = ""; if (c != null) { String mappedName = c.getName(locale).getName(); String[] args = null; if (cp.getState().equals(OpenmrsConstants.CONCEPT_PROPOSAL_SYNONYM)) { args = new String[] { cp.getFinalText(), mappedName, cp.getComments() }; msg = msa.getMessage("ConceptProposal.alert.synonymAdded", args, locale); } else { args = new String[] { cp.getOriginalText(), mappedName, cp.getComments() }; msg = msa.getMessage("ConceptProposal.alert.mappedTo", args, locale); } } else if (cp.getState().equals(OpenmrsConstants.CONCEPT_PROPOSAL_REJECT)) { msg = msa.getMessage("ConceptProposal.alert.ignored", new String[] { cp.getOriginalText(), cp.getComments() }, locale); } try { // allow this user to save changes to alerts temporarily Context.addProxyPrivilege(PrivilegeConstants.MANAGE_ALERTS); alertService.saveAlert(new Alert(msg, uniqueProposers)); } finally { Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_ALERTS); } view = getSuccessView(); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "ConceptProposal.saved"); } return new ModelAndView(new RedirectView(view)); }
From source file:com.hp.hpl.inkml.Ink.java
/** * Method to remove all traceData instances given in the parameter * //from ww w .j av a2 s .c o m * @param traceDataList * @return boolean * @see java.util.AbstractCollection#removeAll(java.util.Collection) */ public boolean removeAllTraceData(final Collection<TraceDataElement> traceDataList) { return traceDataList.removeAll(traceDataList); }
From source file:be.ordina.msdashboard.aggregators.VirtualAndRealDependencyIntegrator.java
public Set<Node> integrateVirtualNodesWithReal(Set<Node> microservicesAndBackends, final Set<Node> indexes, final Collection<Node> virtualNodes) { Set<Node> agregatedNodes = new HashSet<>(); for (Node microserviceOrBackend : microservicesAndBackends) { for (Node virtualNode : virtualNodes) { if (microserviceOrBackend.getId().equals(virtualNode.getId())) { aggregateNodes(microserviceOrBackend, virtualNode); agregatedNodes.add(virtualNode); }/*from w ww.j a v a 2 s .com*/ } } virtualNodes.removeAll(agregatedNodes); microservicesAndBackends.addAll(virtualNodes); return microservicesAndBackends; }
From source file:org.duracloud.account.app.controller.AccountGroupsController.java
private void addAvailableUsersToModel(Collection<DuracloudUser> allUsers, Collection<DuracloudUser> groupUsers, Model model) {// w w w .j av a 2 s. c o m if (allUsers != null && groupUsers != null) { allUsers.removeAll(groupUsers); } model.addAttribute(AVAILABLE_USERS_KEY, allUsers); }
From source file:com.bekioui.jaxrs.server.core.NettyServer.java
private void providers(ResteasyDeployment deployment) { Collection<Object> providers = applicationContext.getBeansWithAnnotation(Provider.class).values(); List<Object> toDelete = providers.stream() // .filter(p -> (!corsEnabled && p instanceof ResteasyCorsFilter) // || (!securityEnabled && p instanceof AuthorizationFilter)) // .collect(Collectors.toList()); providers.removeAll(toDelete); deployment.getProviders().addAll(providers); }