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:br.com.anteros.social.facebook.AnterosFacebookSession.java

private List<String> getNotGrantedPublishPermissions() {
    Set<String> grantedPermissions = getAcceptedPermissions();
    List<String> publishPermissions = new ArrayList<String>(configuration.getPublishPermissions());
    publishPermissions.removeAll(grantedPermissions);
    return publishPermissions;
}

From source file:com.griddynamics.banshun.ContextParentBean.java

protected List<String> excludeConfigLocations(List<String> configLocations) throws Exception {
    for (String location : excludeConfigLocations) {
        configLocations.removeAll(collectConfigLocations(location));
    }//  www  .ja  va 2 s.  c  o  m
    return configLocations;
}

From source file:org.solmix.runtime.support.spring.SpringBeanProvider.java

/**
 * {@inheritDoc}//from  www .  java2s .  c om
 * 
 * @see org.solmix.api.bean.ConfiguredBeanProvider#loadBeansOfType(java.lang.Class,
 *      org.solmix.api.bean.ConfiguredBeanProvider.BeanLoaderListener)
 */
@Override
public <T> boolean loadBeansOfType(Class<T> type, BeanLoaderListener<T> listener) {
    List<String> list = new ArrayList<String>(Arrays.asList(context.getBeanNamesForType(type, false, false)));
    list.removeAll(passThroughs);
    Collections.reverse(list);
    boolean loaded = false;
    for (String s : list) {
        Class<?> beanType = context.getType(s);
        Class<? extends T> t = beanType.asSubclass(type);
        if (listener.loadBean(s, t)) {
            Object o = context.getBean(s);
            if (listener.beanLoaded(s, type.cast(o))) {
                return true;
            }
            loaded = true;
        }
    }
    return loaded || original.loadBeansOfType(type, listener);
}

From source file:com.thesmartweb.swebrank.DataManipulation.java

/**
 * Method that clears a List from duplicates and null elements
 * @param wordList It contains the List to be cleared
 * @return a List cleared from duplicates and null elements
 *///from   w w w.j  a  v  a2 s .c  om
public List<String> clearListString(List<String> wordList) {
    //remove all null elements of the wordlist
    wordList.removeAll(Collections.singleton(null));
    //remove the duplicate elements since HashSet does not allow duplicates
    HashSet<String> hashSet_wordList = new HashSet<String>(wordList);
    //create an iterator to the hashset to add the elements back to the wordlist
    Iterator wordList_iterator = hashSet_wordList.iterator();
    //clear the wordlist
    wordList.clear();
    while (wordList_iterator.hasNext()) {
        wordList.add(wordList_iterator.next().toString());
    }
    return wordList;

}

From source file:Service.FilousServiceImpl.java

/**
 * Cr la liste des filous que l'utilisateur peut ajouter
 *
 * @param idUtilisateur id de l'utilisateur
 * @return Un string contenant les informations des potentiels filous
 *//*from   ww w .jav a2 s .c o  m*/
@Override
public List<PersonnesEntity> getFilous(int idUtilisateur) {

    // Rcupration des personnes inscrites dans la BD
    List<PersonnesEntity> filous = personneDAO.findAll();

    // On enlve l'utilisateur de la liste prcdente pour ne pas qu'il 
    // puisse s'ajouter
    PersonnesEntity user = personneDAO.find(idUtilisateur);
    filous.remove(user);
    // On enlve les amis de l'utilisateur
    filous.removeAll(user.getListFilous());

    return filous;
}

From source file:ja.lingo.engine.EngineModelManager.java

public EngineModelManager(EngineFileNamer fileNamer) throws UnknownCacheVersionException, IOException {
    Arguments.assertNotNull("fileNamer", fileNamer);
    this.fileNamer = fileNamer;

    versioner = new Versioner();

    EngineModel model = BeanPersister.load(EngineModel.class, this.fileNamer.getModelFileName());

    calculateDirtyAndRemovedInfos(model);

    checkCacheVersion(model.getCacheVersion());

    loadedIndexChecksum = model.getIndexChecksum();

    List<IInfo> infos = new ArrayList<IInfo>();
    infos.addAll(model.getInfos());/*  w  w w . j  a  v a2  s.  com*/
    infos.removeAll(dirtyInfos);
    infos.removeAll(removedInfos);

    for (IInfo info : infos) {
        LOG.info("Loading index: " + info);
        enqueueForAdd(info);
    }
}

From source file:com.clican.pluto.dataprocess.dpl.parser.object.filter.OrFilter.java

public void filter(ProcessorContext context) throws DplParseException {
    ProcessorContext context1 = context.getCloneContext();
    DplResultSet dplResultSet1 = context1.getAttribute(CompareFilter.DPL_RESULT_SET);
    if (dplResultSet1 != null) {
        context1.setAttribute(CompareFilter.DPL_RESULT_SET, dplResultSet1.getCloneDplResultSet());
    }//  w ww.  j a  va 2 s  .  c o  m
    ProcessorContext context2 = context.getCloneContext();
    DplResultSet dplResultSet2 = context2.getAttribute(CompareFilter.DPL_RESULT_SET);
    if (dplResultSet2 != null) {
        context2.setAttribute(CompareFilter.DPL_RESULT_SET, dplResultSet2.getCloneDplResultSet());
    }
    filter1.filter(context1);
    dumpTrace(filter1.getExpr(), context1);
    filter2.filter(context2);
    dumpTrace(filter2.getExpr(), context2);
    dplResultSet1 = context1.getAttribute(CompareFilter.DPL_RESULT_SET);
    dplResultSet2 = context2.getAttribute(CompareFilter.DPL_RESULT_SET);
    if (dplResultSet1 != null && dplResultSet2 != null) {
        Set<String> names = new HashSet<String>();
        for (String name : dplResultSet1.getResultNames()) {
            names.add(name);
        }
        for (String name : dplResultSet2.getResultNames()) {
            names.add(name);
        }
        DplResultSet dplResultSet = new DplResultSet();
        dplResultSet.setResultNames(names);
        for (Map<String, Object> rs1 : dplResultSet1.getResultSet()) {
            if (dplResultSet2.getResultSet().size() == 0) {
                Map<String, Object> result = new HashMap<String, Object>(rs1);
                dplResultSet.getResultSet().add(result);
            } else {
                for (Map<String, Object> rs2 : dplResultSet2.getResultSet()) {
                    Map<String, Object> result = new HashMap<String, Object>(rs1);
                    for (String key : rs2.keySet()) {
                        if (!result.containsKey(key)) {
                            result.put(key, rs2.get(key));
                        }
                    }
                    dplResultSet.getResultSet().add(result);
                }
            }
        }

        for (Map<String, Object> rs2 : dplResultSet2.getResultSet()) {
            if (dplResultSet1.getResultSet().size() == 0) {
                Map<String, Object> result = new HashMap<String, Object>(rs2);
                dplResultSet.getResultSet().add(result);
            } else {
                for (Map<String, Object> rs1 : dplResultSet1.getResultSet()) {
                    Map<String, Object> result = new HashMap<String, Object>(rs2);
                    for (String key : rs1.keySet()) {
                        if (!result.containsKey(key)) {
                            result.put(key, rs1.get(key));
                        }
                    }
                    dplResultSet.getResultSet().add(result);
                }
            }
        }
        context.setAttribute(CompareFilter.DPL_RESULT_SET, dplResultSet);
    } else if (dplResultSet1 != null && dplResultSet2 == null) {
        context.setAttribute(CompareFilter.DPL_RESULT_SET, dplResultSet1);
    } else if (dplResultSet2 != null && dplResultSet1 == null) {
        context.setAttribute(CompareFilter.DPL_RESULT_SET, dplResultSet2);
    }

    for (String name : context.getAttributeNames()) {
        if (name.equals(CompareFilter.DPL_RESULT_SET)) {
            continue;
        }
        if (!(context1.getAttribute(name) instanceof List)) {
            continue;
        }
        List<Object> list1 = context1.getAttribute(name);
        List<Object> list2 = context2.getAttribute(name);
        if (list1 == list2) {
            context.setAttribute(name, list1);
            continue;
        }
        list2.removeAll(list1);
        list1.addAll(list2);
        context.setAttribute(name, list1);
    }
}

From source file:com.esri.geoevent.test.performance.ui.ReportOptionsController.java

private void updateSelectedReportColumns(List<String> selectedColumnsList) {
    List<String> currentSelection = selectedColumnsList;
    if (currentSelection == null || currentSelection.size() == 0) {
        currentSelection = new ArrayList<String>(AbstractFileRollOverReportWriter.getDefaultColumnNames());
    }/*ww  w .ja v  a 2s  .com*/

    // remove all items from the all list
    List<String> allColumnsList = new ArrayList<String>(AbstractFileRollOverReportWriter.getAllColumnNames());
    allColumnsList.removeAll(currentSelection);
    allColumns.setItems(FXCollections.observableList(allColumnsList));

    // update the selected list
    selectedColumns.setItems(FXCollections.observableList(currentSelection));
}

From source file:com.demigodsrpg.game.listener.AreaListener.java

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event) {
    // Get the world
    World world = event.getTo().getWorld();

    // If it isn't a DG world, don't listen anymore
    if (!ZoneUtil.isNoDGWorld(world)) {
        AreaRegistry area_r = DGData.AREA_R.get(world.getName());

        // Get the possible areas
        List<Area> areasFrom = area_r.fromLocation(event.getFrom());
        List<Area> areasTo = area_r.fromLocation(event.getTo());

        // Make sure the areas exist
        if (!areasTo.isEmpty()) {

            // Remove all overlapping areas
            areasTo.removeAll(areasFrom);

            // Iterate over all new areas
            for (Area area : areasTo) {
                // Faction territories
                if (area instanceof FactionTerritory) {
                    // Handle the faction territory, check if it should cancel the event
                    FactionTerritory factionArea = (FactionTerritory) area;
                    if (!handleFactionAreas(factionArea, event.getPlayer(), event.getTo(),
                            !(event instanceof PlayerTeleportEvent))) {
                        // Cancel the event
                        event.setCancelled(true);

                        // Bounce back
                        Vector victor = event.getPlayer().getVelocity();
                        victor.multiply(-8); // TODO This is wonky
                        victor.setY(0.5);
                        event.getPlayer().setVelocity(victor);
                    }//from ww w.  ja va 2  s . c  o  m
                }

                // Claim rooms
                else if (area instanceof ClaimRoom) {
                    ClaimRoom claimRoom = (ClaimRoom) area;
                    handleClaimAreas(claimRoom, event.getPlayer());
                }
            }
        }
    }
}

From source file:opendial.plugins.NuanceSpeech.java

/**
 * Creates a new plugin, attached to the dialogue system
 * //from  ww w . j  av a 2s  .  c  om
 * @param system the dialogue system to attach @ in case of missing parameters
 */
public NuanceSpeech(DialogueSystem system) {
    this.system = system;
    List<String> missingParams = new LinkedList<String>(Arrays.asList("id", "key", "lang"));
    missingParams.removeAll(system.getSettings().params.keySet());
    if (!missingParams.isEmpty()) {
        throw new RuntimeException("Missing parameters: " + missingParams);
    }

    currentSynthesis = new ArrayList<SpeechData>();
    buildClients();

    system.enableSpeech(true);
}