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:com.eyem.bean.GrupoBean.java

protected List<Usuario> eliminarUsuariosDeGrupo(List<Usuario> listaTodos) {
    List<Usuario> lista = listaTodos;
    this.usuariosSeleccionados = emailsToUsuarios(this.emailUsuariosSeleccionadosEliminar, this.listaUsuarios);
    lista.removeAll(usuariosSeleccionados);
    return lista;
}

From source file:org.duracloud.account.app.controller.AbstractAccountController.java

protected void loadProviderInfo(Long accountId, Model model) throws AccountNotFoundException {
    AccountService accountService = accountManagerService.getAccount(accountId);

    StorageProviderAccount primarySP = accountService.getPrimaryStorageProvider();
    model.addAttribute("primaryProvider", primarySP);

    Set<StorageProviderAccount> secondarySPs = accountService.getSecondaryStorageProviders();
    model.addAttribute("secondaryProviders", secondarySPs);

    // Get available providers for account
    ProviderForm providerForm = new ProviderForm();
    List<StorageProviderType> availableProviderTypes = StorageProviderTypeUtil.getAvailableSecondaryTypes();

    Set<StorageProviderType> usedTypes = new HashSet<StorageProviderType>();
    for (StorageProviderAccount secondaryAcct : secondarySPs) {
        usedTypes.add(secondaryAcct.getProviderType());
    }// ww w.j a  v a  2 s  .  co  m

    availableProviderTypes.removeAll(usedTypes);

    if (availableProviderTypes.size() > 0) {
        providerForm.setStorageProviders(availableProviderTypes);
    } else {
        providerForm.setStorageProviders(null);
    }

    model.addAttribute("providerForm", providerForm);
}

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

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

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

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

        List<MultiHaplotypeBlockTestResult> 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:net.seedboxer.sources.filter.FilterManager.java

/**
 * After having the content mapped to each user, this method filters the users for each content
 * using the user's history, if history content is equal to a matchedContent, then the user is
 * removed./*from  w ww .ja  v  a 2 s . com*/
 */
private Map<Content, List<User>> filterContentWithHistory(Map<Content, List<User>> mappedContents) {
    List<Content> toRemove = new ArrayList<Content>();

    for (Map.Entry<Content, List<User>> entries : mappedContents.entrySet()) {

        Content content = entries.getKey();
        List<User> users = entries.getValue();
        List<User> usersThatAlreadyHaveThisContent = contentManager.getUsersWithContentInHistory(content,
                users);

        if (users.size() == usersThatAlreadyHaveThisContent.size()) {
            toRemove.add(content);
        } else {
            users.removeAll(usersThatAlreadyHaveThisContent);
        }
    }

    for (Content content : toRemove) {
        mappedContents.remove(content);
    }
    return mappedContents;
}

From source file:info.magnolia.cms.util.WebXmlUtil.java

/**
 * Returns:/*w  ww .  ja  v  a  2 s.c o  m*/
 * +1 if all mandatory dispatchers are present and no additional unsupported dispatcher is present, or this filter class isn't registered.
 * 0  if all mandatory dispatchers are present but additional unsupported dispatchers are present.
 * -1  if not all mandatory dispatchers are present.
 */
public int checkFilterDispatchersConfiguration(String filterClass, List mandatoryDispatchers,
        List optionalDispatchers) {
    final Element filterEl = getFilterElement(filterClass);
    if (filterEl != null) {
        final String filterName = filterEl.getTextNormalize();
        final String filterMappingXPathExpr = "/webxml:web-app/webxml:filter-mapping[webxml:filter-name='"
                + filterName + "']/webxml:dispatcher";
        final List dispatchersEl = getElementsFromXPath(filterMappingXPathExpr);
        final List registeredDispatchers = new ArrayList();
        final Iterator it = dispatchersEl.iterator();
        while (it.hasNext()) {
            final Element dispatcherEl = (Element) it.next();
            registeredDispatchers.add(dispatcherEl.getTextNormalize());
        }
        registeredDispatchers.removeAll(optionalDispatchers);
        if (CollectionUtils.isEqualCollection(mandatoryDispatchers, registeredDispatchers)) {
            return 1;
        } else if (CollectionUtils.isSubCollection(mandatoryDispatchers, registeredDispatchers)) {
            return 0;
        } else {
            return -1;
        }

    }
    return 1;
}

From source file:com.hpe.application.automation.tools.octane.executor.UFTTestDetectionService.java

/**
 * Deleted data table might be part of deleted test. During discovery its very hard to know.
 * Here we pass through all deleted data tables, if we found data table parent is test folder - we know that the delete was part of test delete
 *
 * @param deletedTests//from   ww w  .  j  a  v  a 2s  .  c o  m
 * @param deletedScmResourceFiles
 */
private static void removeFalsePositiveDeletedDataTables(List<AutomatedTest> deletedTests,
        List<ScmResourceFile> deletedScmResourceFiles) {
    if (!deletedScmResourceFiles.isEmpty() && !deletedTests.isEmpty()) {

        List<ScmResourceFile> falsePositive = new ArrayList<>();
        for (ScmResourceFile item : deletedScmResourceFiles) {
            int parentSplitterIndex = item.getRelativePath().lastIndexOf(windowsPathSplitter);
            if (parentSplitterIndex != -1) {
                String parentName = item.getRelativePath().substring(0, parentSplitterIndex);
                for (AutomatedTest test : deletedTests) {
                    String testPath = StringUtils.isEmpty(test.getPackage()) ? test.getName()
                            : test.getPackage() + windowsPathSplitter + test.getName();
                    if (testPath.equals(parentName)) {
                        falsePositive.add(item);
                        break;
                    }
                }
            }
        }
        deletedScmResourceFiles.removeAll(falsePositive);
    }
}

From source file:de.widone.web.page.home.HomePage.java

@Override
public void onEvent(IEvent<?> event) {
    super.onEvent(event);
    if (event.getPayload() instanceof ChangeTaskPositionEvent) {
        ChangeTaskPositionEvent changePosEvent = (ChangeTaskPositionEvent) event.getPayload();
        Task task = changePosEvent.getTask();
        List<Task> tasks = changePosEvent.getTaskList().getTasks();
        Integer newPos = changePosEvent.getNewPosition();
        Integer oldPos = tasks.indexOf(task);
        if (newPos < 0 || newPos >= tasks.size()) {
            return;
        }//from w w  w  .j av a  2  s.  co m
        tasks.remove(task);
        List<Task> sublist = new ArrayList<Task>(tasks.subList(newPos, tasks.size()));
        tasks.removeAll(sublist);
        tasks.add(task);
        tasks.addAll(sublist);
        ((IModel<TaskList>) getDefaultModel()).setObject(taskListService.update(changePosEvent.getTaskList()));
    } else if (event.getPayload() instanceof DoneTaskEvent) {
        DoneTaskEvent deleteTaskEvent = (DoneTaskEvent) event.getPayload();
        TaskList taskList = deleteTaskEvent.getTaskList();
        taskList.getTasks().remove(deleteTaskEvent.getTask());
        ((IModel<TaskList>) getDefaultModel()).setObject(taskListService.update(taskList));
    } else if (event.getPayload() instanceof DeleteTaskEvent) {
        DeleteTaskEvent deleteTaskEvent = (DeleteTaskEvent) event.getPayload();
        TaskList taskList = deleteTaskEvent.getTaskList();
        taskList.getTasks().remove(deleteTaskEvent.getTask());
        ((IModel<TaskList>) getDefaultModel()).setObject(taskListService.update(taskList));
    } else if (event.getPayload() instanceof NewTaskEvent) {
        NewTaskEvent newTaskEvent = (NewTaskEvent) event.getPayload();
        ((IModel<TaskList>) getDefaultModel()).setObject(taskListService.addTaskToTaskList(
                newTaskEvent.getNewTask(), ((IModel<TaskList>) getDefaultModel()).getObject()));
    } else if (event.getPayload() instanceof NewTaskListEvent) {
        NewTaskListEvent newTaskListEvent = (NewTaskListEvent) event.getPayload();
        User user = userService.initTaskLists(new CurrentUserModel().getObject());
        user.getTaskLists().add(newTaskListEvent.getNewTaskList());
        userService.update(user);
    }
}

From source file:com.alibaba.jstorm.schedule.default_assign.ResourceWorkerSlot.java

public ResourceWorkerSlot(WorkerAssignment worker, Map<String, List<Integer>> componentToTask) {
    super(worker.getNodeId(), worker.getPort());
    this.hostname = worker.getHostName();
    this.tasks = new HashSet<Integer>();
    this.cpu = worker.getCpu();
    this.memSize = worker.getMem();
    this.jvm = worker.getJvm();
    for (Entry<String, Integer> entry : worker.getComponentToNum().entrySet()) {
        List<Integer> tasks = componentToTask.get(entry.getKey());
        if (tasks == null || tasks.size() == 0)
            continue;
        int num = Math.min(tasks.size(), entry.getValue().intValue());
        List<Integer> cTasks = new ArrayList<Integer>();
        cTasks.addAll(tasks.subList(0, num));
        this.tasks.addAll(cTasks);
        tasks.removeAll(cTasks);
    }//w  w  w.  ja va  2s .c  o  m
}

From source file:org.obiba.mica.study.service.HarmonizationStudyService.java

private List<String> populationsAffected(HarmonizationStudy study, HarmonizationStudy oldStudy) {
    if (oldStudy != null) {
        List<String> newPopIDs = study.getPopulations().stream().map(Population::getId).collect(toList());
        List<String> oldPopIDs = oldStudy.getPopulations().stream().map(Population::getId).collect(toList());

        boolean isChangeSignificant = newPopIDs.size() <= oldPopIDs.size() && !newPopIDs.containsAll(oldPopIDs);
        if (isChangeSignificant) {
            oldPopIDs.removeAll(newPopIDs);
            return oldPopIDs;
        } else/*from   w ww .  ja va  2 s .c  om*/
            return null;
    } else
        return null;
}

From source file:com.inkubator.hrm.web.organisation.OrgTypeOfSpecListFormController.java

public void doDualListModelKlasifikasiKerja(Boolean isUpdate, OrgTypeOfSpecList orgTypeOfSpecList)
        throws Exception {
    List<KlasifikasiKerja> sourceKlasifikasiKerja = klasifikasiKerjaService.getAllData();
    if (isUpdate) {
        List<KlasifikasiKerja> selectedListKlasifikasiKerja = orgTypeOfSpecList.getKlasifikasiKerja();
        sourceKlasifikasiKerja.removeAll(selectedListKlasifikasiKerja);
        dualListModel = new DualListModel<>(sourceKlasifikasiKerja, selectedListKlasifikasiKerja);
    } else {//from   w ww.ja v  a2s.c  o  m
        dualListModel.setSource(sourceKlasifikasiKerja);
    }
}