Example usage for java.util List removeAll

List of usage examples for java.util List removeAll

Introduction

In this page you can find the example usage for java.util List removeAll.

Prototype

boolean removeAll(Collection<?> c);

Source Link

Document

Removes from this list all of its elements that are contained in the specified collection (optional operation).

Usage

From source file:fi.vm.sade.organisaatio.service.search.it.TestIndexingSearching.java

private void assertContent(List<String> reference, List<OrganisaatioPerustieto> result) {
    List<String> resultOids = Lists.newArrayList();
    for (OrganisaatioPerustieto org : result) {
        resultOids.add(org.getOid());/*from  ww  w . j av a2s . c  o m*/
    }
    List<String> operate = Lists.newArrayList(resultOids);
    operate.removeAll(resultOids);
    Assert.assertEquals("Content mismatch:" + resultOids + "!=" + reference, 0, operate.size());
}

From source file:org.businessmanager.service.security.GroupServiceImpl.java

private void removeUserFromGroup(User user, Group group) {
    List<User> userList = group.getMembers();
    List<User> removeList = new ArrayList<User>();
    for (User userInList : userList) {
        if (userInList.getId() != null && userInList.getId().equals(user.getId())) {
            removeList.add(userInList);/*from w  w  w.  ja  va2s. c  o m*/
        }
    }
    userList.removeAll(removeList);
    assignUsersToGroup(userList, group);
}

From source file:com.inkubator.hrm.web.account.UserFormController.java

@PostConstruct
@Override//w  ww.j  ava 2  s  .  c om
public void initialization() {
    try {
        super.initialization();
        String userId = FacesUtil.getRequestParameter("execution");
        if (userId != null) {
            isEdit = Boolean.TRUE;
            HrmUser selectedHrmUser = hrmUserService
                    .getEntiyByPkWithDetail(Long.parseLong(userId.substring(1)));
            userModel = getUserModelFromEntity(selectedHrmUser);
            List<HrmRole> sourceSpiRole = this.hrmRoleService.getAllData();
            List<HrmRole> targetRole = selectedHrmUser.getRoles();
            boolean a = sourceSpiRole.removeAll(targetRole);

            dualListModel = new DualListModel<>(sourceSpiRole, targetRole);
        } else {
            List<HrmRole> sourceSpiRole = this.hrmRoleService.getAllData();
            dualListModel.setSource(sourceSpiRole);
            userModel = new UserModel();
            isEdit = Boolean.FALSE;
        }
        passwordComplexity = passwordComplexityService.getByCode(HRMConstant.PASSWORD_CONFIG_CODE);
    } catch (Exception ex) {
        LOGGER.error("Error", ex);
    }
}

From source file:com.sixsq.slipstream.run.RunNodeResource.java

private void removeNodeInstanceIndices(Run run, List<String> ids)
        throws NotFoundException, AbortException, ValidationException {

    List<String> nodeIds = new ArrayList<String>(Arrays.asList(getNodeInstanceIndices(run).split("\\s*,\\s*")));

    nodeIds.removeAll(ids);
    String newNodeIds = StringUtils.join(nodeIds, ",");
    setNodeInstanceIndices(run, newNodeIds);
}

From source file:edu.isistan.carcha.evaluator.CarchaEvaluator.java

/**
 * Evaluate./*from  w w w . j a  v a2s .c o  m*/
 *
 * @param goldenDirectory the golden directory
 * @param annotatedDirectory the annotated directory
 * @throws UIMAException the uIMA exception
 * @throws IOException Signals that an I/O exception has occurred.
 */
public void evaluate(File goldenDirectory, File annotatedDirectory) throws UIMAException, IOException {

    File[] goldens = FileUtils.listFiles(goldenDirectory, new String[] { "xmi" }, false).toArray(new File[] {});
    File[] annotated = FileUtils.listFiles(annotatedDirectory, new String[] { "xmi" }, false)
            .toArray(new File[] {});

    for (int i = 0; i < goldens.length; i++) {
        String goldenFileName = goldens[i].getName();
        String annotatedFileName = annotated[i].getName();

        logger.info("\n----------------\nComparing " + goldenFileName + " with " + annotatedFileName
                + "\n----------------\n");

        List<String> goldenSentences = Utils.extractCoveredTextAnnotations(goldens[i].getAbsolutePath(),
                Sentence.class);
        List<String> goldenConcern = Utils.extractCoveredTextAnnotations(goldens[i].getAbsolutePath(),
                DesignDecision.class);
        List<String> discoveredConcern = Utils.extractCoveredTextAnnotations(annotated[i].getAbsolutePath(),
                DesignDecision.class);

        goldenSentences.removeAll(discoveredConcern);
        goldenConcern.removeAll(discoveredConcern);

        logger.info("untraced concerns " + goldenConcern.size());
        logger.info("untraced sentences " + goldenSentences.size());

    }
}

From source file:org.jax.bham.test.HaplotypeAssociationTestGraphPanel.java

private void cacheChromosomeTests(final int[] chromosomes) {
    List<Integer> chromosomesToCalculate = SequenceUtilities.toIntegerList(chromosomes);
    chromosomesToCalculate.removeAll(this.chromosomeToNegLogValueMap.keySet());

    PerformHaplotypeAssociationTestTask testTask = new PerformHaplotypeAssociationTestTask(this.testToPlot,
            chromosomesToCalculate);// w  w  w. j  a  v  a2  s.  co m
    MultiTaskProgressPanel progressTracker = BhamApplication.getInstance().getBhamFrame()
            .getMultiTaskProgress();
    progressTracker.addTaskToTrack(testTask, true);

    while (testTask.hasMoreElements()) {
        int nextChromosome = testTask.getNextChromosome();
        HaplotypeBlockTestResult[] results = testTask.nextElement();

        List<HaplotypeBlockTestResult> filteredResults = OcclusionFilter
                .filterOutOccludedIntervals(Arrays.asList(results), true);

        RealValuedBasePairInterval[] negLogResults = new RealValuedBasePairInterval[filteredResults.size()];
        for (int i = 0; i < negLogResults.length; i++) {
            negLogResults[i] = new CompositeRealValuedBasePairInterval(
                    filteredResults.get(i).getDelegateInterval(),
                    -Math.log10(filteredResults.get(i).getPValue()));
        }

        this.chromosomeToNegLogValueMap.put(nextChromosome, negLogResults);
    }
}

From source file:org.jax.bham.test.PhylogenyAssociationTestGraphPanel.java

private void cacheChromosomeTests(final int[] chromosomes) {
    List<Integer> chromosomesToCalculate = SequenceUtilities.toIntegerList(chromosomes);
    chromosomesToCalculate.removeAll(this.chromosomeResultsCache.keySet());

    PerformPhylogenyAssociationTestTask testTask = new PerformPhylogenyAssociationTestTask(this.testToPlot,
            chromosomesToCalculate);//from  ww w. j a  v a2  s  .c o  m
    MultiTaskProgressPanel progressTracker = BhamApplication.getInstance().getBhamFrame()
            .getMultiTaskProgress();
    progressTracker.addTaskToTrack(testTask, true);

    while (testTask.hasMoreElements()) {
        int nextChromosome = testTask.getNextChromosome();
        List<PhylogenyTestResult> results = testTask.nextElement();

        List<PhylogenyTestResult> filteredResults = OcclusionFilter.filterOutOccludedIntervals(results, true);

        PhylogenyAssociationTestGraphPanel.this.chromosomeResultsCache.put(nextChromosome, filteredResults);
    }
}

From source file:com.turbospaces.spaces.SpaceReceiveAdapter.java

@Override
public void viewAccepted(final View view) {
    final Address[] prevConnectors = clientConnectors;
    final Address[] newClientConnectors = getClientConnections(view);

    if (prevConnectors != null) {
        List<Address> l = new ArrayList<Address>(Arrays.asList(prevConnectors));
        l.removeAll(Arrays.asList(newClientConnectors));

        // automatically roll-back un-committed transactions, we can't leave them as this as they holds locks
        for (Address a : l) {
            Cache<Long, SpaceTransactionHolder> modificationContextFor = modificationContextFor(a);
            ConcurrentMap<Long, SpaceTransactionHolder> asMap = modificationContextFor.asMap();
            Set<Entry<Long, SpaceTransactionHolder>> entrySet = asMap.entrySet();
            for (Entry<Long, SpaceTransactionHolder> entry : entrySet) {
                Long transactionId = entry.getKey();
                SpaceTransactionHolder transactionHolder = entry.getValue();
                logger.warn(/*w ww .j a v a  2 s. c o  m*/
                        "automatically rolling back transaction id={} due to client's connection disconnect",
                        transactionId);
                jSpace.syncTx(transactionHolder.getModificationContext(), false);
                modificationContextFor.invalidate(transactionId);
            }
        }
    }

    clientConnectors = newClientConnectors;
}

From source file:org.jdal.swing.Selector.java

/**
 * Sets the available list/*from   w w  w. ja  v  a  2 s.c o m*/
 * @param available list to set
 */
public void setAvailable(List<T> available) {
    this.available.clear();
    this.available.addAll(available);
    List<T> l = new ArrayList<T>(all);
    l.removeAll(available);
    selected.clear();
    selected.addAll(l);
}

From source file:com.streamsets.datacollector.validation.PipelineConfigurationValidator.java

/**
 * We have special type of a ConfigDef called RUNTIME. This config is never displayed in UI and instead it's values
 * are supplied at "runtime". This method is the "runtime" method that propagates them.
 *///from  www .  java 2s.c  om
private void propagateRuntimeConfiguration() {
    // If pipeline wasn't loaded or there if there are no stages, there is nothing to propagate
    if (pipelineBean == null || pipelineBean.getPipelineStageBeans() == null) {
        return;
    }

    for (StageBean stageBean : pipelineBean.getPipelineStageBeans().getStages()) {
        for (ServiceDependencyDefinition serviceDependency : stageBean.getDefinition().getServices()) {

            ServiceBean stageService = stageBean.getService(serviceDependency.getService());
            if (stageService == null) {
                continue;
            }
            ServiceConfiguration serviceConfiguration = stageService.getConf();
            List<Config> configs = serviceConfiguration.getConfiguration();

            // Simply remove all RUNTIME configs
            configs.removeAll(serviceDependency.getConfiguration().keySet().stream()
                    .map(serviceConfiguration::getConfig).collect(Collectors.toList()));

            // And insert them with the stage-instance-constant values
            serviceDependency.getConfiguration().forEach((key, value) -> configs.add(new Config(key, value)));

            // And overwrite the new state
            serviceConfiguration.setConfig(configs);
        }
    }
}