List of usage examples for java.util Collection removeAll
boolean removeAll(Collection<?> c);
From source file:org.openthinclient.util.dpkg.DPKGPackageManager.java
/** * {@inheritDoc}/* w w w . j av a2 s . com*/ */ public Collection<Package> getInstallablePackagesWithoutInstalledOfSameVersion() { Collection<Package> installablePackages = getInstallablePackages(); Collection<Package> installedPackages = getInstalledPackages(); installablePackages.removeAll(installedPackages); return installablePackages; }
From source file:org.apache.openjpa.util.AbstractLRSProxyMap.java
public boolean containsValue(Object val) { if (_valueType != null && !_valueType.isInstance(val)) return false; if (_map != null && _map.containsValue(val)) return true; if (!_ct.getTrackKeys()) { if (_ct.getRemoved().contains(val)) return false; return hasValue(val); }// www.j a v a2s . c o m // key tracking Collection<K> keys = keys(val); if (keys == null || keys.isEmpty()) return false; keys.removeAll(_ct.getRemoved()); keys.removeAll(_ct.getChanged()); return keys.size() > 0; }
From source file:com.frostwire.android.gui.Librarian.java
private void scan(final Context context, File file, Set<File> ignorableFiles) { //if we just have a single file, do it the old way if (file.isFile()) { if (ignorableFiles.contains(file)) { return; }/*from w w w . ja va 2 s . c o m*/ new UniversalScanner(context).scan(file.getAbsolutePath()); } else if (file.isDirectory() && file.canRead()) { Collection<File> flattenedFiles = getAllFolderFiles(file, null); if (ignorableFiles != null && !ignorableFiles.isEmpty()) { flattenedFiles.removeAll(ignorableFiles); } if (flattenedFiles != null && !flattenedFiles.isEmpty()) { new UniversalScanner(context).scan(flattenedFiles); } } }
From source file:ubic.gemma.web.controller.expression.experiment.AnnotationController.java
public void removeExperimentTag(Collection<Long> characterIds, Long eeId) { ExpressionExperiment ee = expressionExperimentService.load(eeId); if (ee == null) { return;//w ww .j a v a 2s . c o m } ee = expressionExperimentService.thawLite(ee); Collection<Characteristic> current = ee.getCharacteristics(); Collection<Characteristic> found = new HashSet<>(); for (Characteristic characteristic : current) { if (characterIds.contains(characteristic.getId())) found.add(characteristic); } for (Characteristic characteristic : found) { log.info("Removing characteristic from " + ee + " : " + characteristic); } current.removeAll(found); ee.setCharacteristics(current); expressionExperimentService.update(ee); for (Long id : characterIds) { characteristicService.remove(id); } }
From source file:edu.ksu.cis.indus.staticanalyses.impl.ClassHierarchy.java
/** * Prunes the class hierarchy to only include the given classes. The transitive inheritance relationship between the * retained classes can be preserved via <code>retainTransitiveInheritanceRelation</code>. * /*from ww w .j a va 2 s. co m*/ * @param confineToClasses is the collection of classes to confine the hierarchy to. * @param retainTransitiveInheritanceRelation <code>true</code> indicates that the transitive inheritance relationship * between classes via classes not mentined in <code>confiningClasses</code> should be retained; * <code>false</code>, otherwise. * @pre confineToClasses != null and confineToClasses.oclIsKindOf(Collection(SootClass)) */ public void confine(final Collection confineToClasses, final boolean retainTransitiveInheritanceRelation) { final Collection<SootClass> _classesToRemove = new HashSet<SootClass>(); _classesToRemove.addAll(classes); _classesToRemove.addAll(interfaces); _classesToRemove.removeAll(confineToClasses); if (retainTransitiveInheritanceRelation) { removeClassesAndRetainInheritanceRelation(_classesToRemove); } else { final Iterator<SootClass> _i = _classesToRemove.iterator(); final int _iEnd = _classesToRemove.size(); for (int _iIndex = 0; _iIndex < _iEnd; _iIndex++) { final SootClass _sc = _i.next(); final SimpleNode<SootClass> _node = classHierarchy.queryNode(_sc); classHierarchy.removeNode(_node); } } classes.retainAll(confineToClasses); interfaces.retainAll(confineToClasses); }
From source file:no.sesat.search.mode.config.FastCommandConfig.java
private String createCollectionFilterString() { String result = ""; if (collections.size() > 1) { // <-- DEPRECATED. not sesat. final Collection<String> invertedCollection = new ArrayList<String>(Arrays.asList(ALL_COLLECTIONS)); invertedCollection.removeAll(collections); final String[] coll = prependMetaCollection(invertedCollection); result = StringUtils.join(coll, ' '); // --> } else if (collections.size() == 1) { result = "+meta.collection:" + collections.get(0); }/*from www. j a v a 2 s .com*/ return result; }
From source file:net.navasoft.madcoin.backend.services.rest.impl.ProviderScope.java
/** * Validate scope./* w ww . j a va2 s .co m*/ * * @param total * the total * @return the collection * @throws Exception * the exception * @since 8/09/2014, 01:45:11 AM */ @Override public Collection<T> validateScope(Collection<T> total) throws Exception { boolean valid = true; int na = 0; int arbitrary = total.size(); Collection<WorkingLoad> filtered = new ArrayList<WorkingLoad>(); for (T individual : total) { individual.setEvaluator(originator); boolean removals = individual.applyPolicies(); if (!removals) { filtered.add(individual); na++; } valid &= removals; } total.removeAll(filtered); journal.info("Cantidad de Elementos de alcance: " + total.size()); if (valid || (na != arbitrary)) { return total; } else { throw new Exception("Alcance totalmente invlido"); } }
From source file:com.sjsu.crawler.Crawler.java
/** * Starts the crawling process in a single thread. * * Before starting the crawling process, the model and the parser have to be * set.//from w w w.java 2s . c o m * * @see com.sjsu.crawler.core.ICrawler#start() */ public final void start() { // loop until there aren't any URIs anymore while (!model.isEmpty()) { // remove a link from the stack Link link = model.pop(); PageData pageData = parser.load(link); if (isPageDataOK(pageData)) { final Collection outLinks = parser.parse(pageData, linkFilter); // ******To print outlinks/child urls*********** Iterator iterator = outLinks.iterator(); while (iterator.hasNext()) { String val = (String) iterator.next(); //System.out.println("Outlinks:"+val); } fireParserEvent(link, pageData, outLinks); // remove already visited URIs from the outgoing links list outLinks.removeAll(model.getVisitedURIs()); // the rest of the URIs are new and can be visited model.add(link, outLinks); } } }
From source file:org.openspaces.grid.gsm.containers.DefaultContainersSlaEnforcementEndpoint.java
@Override public GridServiceContainer[] getContainers() { validateEndpointNotDestroyed(pu);//from w w w.java2s . com Collection<GridServiceContainer> approvedContainers = ContainersSlaUtils.getContainersByZone(pu.getAdmin(), ContainersSlaUtils.getContainerZone(pu)); approvedContainers.removeAll(state.getContainersMarkedForDeallocation(pu)); return approvedContainers.toArray(new GridServiceContainer[approvedContainers.size()]); }
From source file:de.ks.flatadocdb.session.Session.java
@Override public void prepare() { Set<SessionEntry> renamed = handleRenames(); Collection<SessionEntry> dirty = dirtyChecker.findDirty(new HashSet<>(this.entriesById.values())); dirty.removeAll(renamed); dirty.forEach(e -> {/*ww w.j a va 2s . c o m*/ e.getEntityDescriptor().getChildRelations().stream()// .flatMap(r -> r.getRelatedEntities(e.getObject()).stream())// .filter(o -> metaModel.getEntityDescriptor(o.getClass()).getId(o) == null)// .filter(o -> !entity2Entry.containsKey(o))// .forEach(this::persist); }); dirty.stream().map(e -> new EntityUpdate(repository, e)).forEach(actions::add); for (SessionAction action : this.actions) { try { action.prepare(this); } catch (RuntimeException e) { rollbackonly = true; throw e; } } }