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:org.string_db.psicquic.index.DataConsistencyITCase.java

@Test
public void test_if_all_collection_ids_are_mapped() throws Exception {
    final List<String> collections = db.queryForList("SELECT DISTINCT (collection_id) FROM evidence.sets",
            String.class);
    collections.removeAll(SourceDbLookup.collections.keySet());
    if (!collections.isEmpty()) {
        Assert.fail("not all collections are mapped: " + collections);
    }//from  w  w  w.j a v  a  2  s .  c om
}

From source file:com.example.data.PetData.java

public List<Map<String, Object>> findPetByTags(String tags) throws SQLException {
    QueryRunner run = new QueryRunner(H2DB.getDataSource());
    List<String> tagList = Arrays.asList(tags.split(","));

    if (tagList.isEmpty())
        return Collections.EMPTY_LIST;
    else {/*from  w ww . ja va2 s . c o  m*/
        return run
                .query("select * from pet",
                        H2DB.mkResultSetHandler("id", "name", "categoryId", "photoUrls", "tags", "status"))
                .stream().map(m -> {
                    m.put("photoUrls", H2DB.strToList((String) m.get("photoUrls")));
                    m.put("tags", H2DB.strToList((String) m.get("tags")));
                    m.put("category", getCategory(run, (Long) m.get("categoryId")));
                    m.remove("categoryId");
                    return m;
                }).filter(m -> {
                    if (m.get("tags") == null)
                        return false;
                    else {
                        List<String> its = (List<String>) m.get("tags");
                        List<String> tmp = new ArrayList<>(its);
                        tmp.removeAll(tagList);
                        return tmp.size() != its.size();
                    }
                }).collect(Collectors.toList());
    }
}

From source file:de.tudarmstadt.ukp.csniper.resbuild.stuff.InclusionsCreator.java

@Test
public void createInclusionsFile() throws IOException {
    List<String> all = read(BASE_0, "xml");
    //      all.removeAll(cut(read(BASE, "csv"), read(BASE, "xz")));
    all.removeAll(cut(read(BASE, "csv"), stripPlusXml(read("serialized.txt"))));
    //      all.removeAll(read(BASE, "csv"));
    FileUtils.writeLines(new File(BASE, "inclusions.txt"), "UTF-8", all);
    //      all.removeAll(read(BASE, "xz"));
    //      all.removeAll(read(BASE, "csv"));
    IOUtils.writeLines(all, "\n", System.out, "UTF-8");
}

From source file:com.plan.proyecto.repositorios.DaoCuentaImpl.java

@Override
public List<Cuenta> findAmigosPotencialesByCuenta(Cuenta cuenta) {
    //        Query query = em.createNamedQuery("Cuenta.findAmigosPotencialesByCuenta",Cuenta.class);       
    //        query.setParameter("idorigen", cuenta.getId());

    List<Cuenta> amigos = findAmigosByCuenta(cuenta);

    List<Cuenta> usuarios = findAll();

    usuarios.remove(cuenta);/* www.ja  v a2  s.  com*/

    usuarios.removeAll(amigos);

    return usuarios;
}

From source file:net.sp1d.chym.loader.service.TrackerService.java

public List<Series> loadNewSeriesFromTracker(Tracker tracker, List<Series> existingSeries) throws IOException {
    LOG.info("Loading new series from tracker {}", tracker.getClass().getSimpleName());

    List<Series> newSeries = tracker.loadSeries();
    newSeries.removeAll(existingSeries);

    LOG.info("{} new series was found", newSeries.size());
    return newSeries;
}

From source file:com.hp.octane.integrations.services.vulnerabilities.SSCOctaneClosedIssuesSync.java

private List<OctaneIssue> getClosedInSSCOpenInOctane(List<String> octaneIssues, Issues sscIssues) {

    if (sscIssues.getCount() == 0) {
        return new ArrayList<>();
    }/*  w w w.  ja  v  a 2s .co  m*/
    List<String> remoteIdsSSC = sscIssues.getData().stream().map(t -> t.issueInstanceId)
            .collect(Collectors.toList());
    List<String> retVal = new ArrayList<>(octaneIssues);
    retVal.removeAll(remoteIdsSSC);
    //Make Octane issue from remote id's.
    Entity closedListNodeEntity = createListNodeEntity(dtoFactory, "list_node.issue_state_node.closed");
    return retVal.stream().map(t -> {
        OctaneIssueImpl octaneIssue = new OctaneIssueImpl();
        octaneIssue.setRemoteId(t);
        octaneIssue.setState(closedListNodeEntity);
        return octaneIssue;
    }).collect(Collectors.toList());

}

From source file:com.tealcube.minecraft.bukkit.mythicdrops.utils.ItemUtil.java

/**
 * Gets a {@link Collection} of {@link Material}s that the given {@link Tier} contains.
 *
 * @param tier/*from w  w  w .j  a v a 2s  . c o  m*/
 *         Tier to check
 * @return All Materials for the given Tier
 */
public static Collection<Material> getMaterialsFromTier(Tier tier) {
    if (tier == null) {
        return new ArrayList<>();
    }
    List<String> idList = new ArrayList<>(tier.getAllowedItemIds());
    for (String itemType : tier.getAllowedItemGroups()) {
        if (plugin.getConfigSettings().getItemTypesWithIds().containsKey(itemType.toLowerCase())) {
            idList.addAll(plugin.getConfigSettings().getItemTypesWithIds().get(itemType.toLowerCase()));
        }
        if (plugin.getConfigSettings().getMaterialTypesWithIds().containsKey(itemType.toLowerCase())) {
            idList.addAll(plugin.getConfigSettings().getMaterialTypesWithIds().get(itemType.toLowerCase()));
        }
    }
    for (String itemType : tier.getDisallowedItemGroups()) {
        if (plugin.getConfigSettings().getItemTypesWithIds().containsKey(itemType.toLowerCase())) {
            idList.removeAll(plugin.getConfigSettings().getItemTypesWithIds().get(itemType.toLowerCase()));
        }
        if (plugin.getConfigSettings().getMaterialTypesWithIds().containsKey(itemType.toLowerCase())) {
            idList.removeAll(plugin.getConfigSettings().getMaterialTypesWithIds().get(itemType.toLowerCase()));
        }
    }
    idList.removeAll(tier.getDisallowedItemIds());
    Set<Material> materials = new HashSet<>();
    for (String s : idList) {
        Material material = Material.getMaterial(s);
        if (material == Material.AIR) {
            continue;
        }
        materials.add(material);
    }
    return materials;
}

From source file:net.sp1d.chym.loader.service.TrackerService.java

public List<Series> loadNewSeries(List<Series> existingSeries) throws IOException {
    LOG.info("Loading new series from all trackers");

    List<Series> newSeries = new ArrayList<>();
    for (Tracker tracker : trackers) {
        List<Series> trackerSeries = tracker.loadSeries();
        trackerSeries.removeAll(existingSeries);
        newSeries.addAll(trackerSeries);
    }/*w w  w .j a  va 2s.  c  o  m*/

    LOG.info("{} new series was found", newSeries.size());
    return newSeries;
}

From source file:com.croer.services.ItembusqManagement.java

@Transactional
public void saveContext(Itembusq itembusq, List<Ortograma> ortoList, List<Simigrama> simiList,
        Diccionario diccionario) {//from   w ww . j  av  a2s  .c o m
    List<Ortograma> ortoListOld = new ArrayList<>();
    if (itembusqRepository.exists(itembusq.getItembusqPK())) {
        Itembusq findOne = itembusqRepository.findOne(itembusq.getItembusqPK());
        List<ItemOrtograma> tmpIO = findOne.getItemOrtogramaList();
        tmpIO.removeAll(itembusq.getItemOrtogramaList());
        for (ItemOrtograma itemOrtograma : tmpIO) {
            ortoListOld.add(itemOrtograma.getOrtograma1());
        }
    }

    diccionarioRepository.save(diccionario);
    ortogramaRepository.save(ortoList); //Da de alta los DO's pero no borra al salvar
    itembusqRepository.save(itembusq); //Da de alta los IO's borra al salvar 
    simigramaRepository.save(simiList);
    //flush
    borraOrtograma(ortoListOld, itembusq);
}

From source file:com.github.rinde.rinsim.central.RandomSolver.java

@Override
public ImmutableList<ImmutableList<Parcel>> solve(GlobalStateObject state) {
    checkArgument(!state.getVehicles().isEmpty(), "Need at least one vehicle.");
    final LinkedListMultimap<VehicleStateObject, Parcel> map = LinkedListMultimap.create();

    final Set<Parcel> available = newLinkedHashSet(state.getAvailableParcels());
    final Set<Parcel> destinations = newLinkedHashSet();
    for (final VehicleStateObject vso : state.getVehicles()) {
        destinations.addAll(vso.getDestination().asSet());
    }/*from w ww  . j  ava2 s .c o m*/
    available.removeAll(destinations);

    // do random assignment of available parcels
    for (final Parcel p : available) {
        final int index = randomGenerator.nextInt(state.getVehicles().size());
        map.put(state.getVehicles().get(index), p);
        map.put(state.getVehicles().get(index), p);
    }

    final ImmutableList.Builder<ImmutableList<Parcel>> builder = ImmutableList.builder();
    // insert contents, shuffle ordering, insert destination if applicable
    for (final VehicleStateObject vso : state.getVehicles()) {
        final List<Parcel> assigned = newArrayList(map.get(vso));
        final List<Parcel> conts = newArrayList(vso.getContents());
        conts.removeAll(vso.getDestination().asSet());
        assigned.addAll(conts);
        if (vso.getDestination().isPresent()
                && state.getAvailableParcels().contains(vso.getDestination().get())) {
            assigned.add(vso.getDestination().get());
        }
        Collections.shuffle(assigned, new RandomAdaptor(randomGenerator));
        if (vso.getDestination().isPresent()) {
            assigned.add(0, vso.getDestination().get());
        }
        builder.add(ImmutableList.copyOf(assigned));
    }
    return builder.build();
}