List of usage examples for java.util Set removeAll
boolean removeAll(Collection<?> c);
From source file:io.kahu.hawaii.domain.FieldChecker.java
public boolean checkAllFieldsAreBlankExcept(Object bean, String... ignoredFieldNames) throws ServerException { Set<String> fieldNames = getFieldNames(bean); fieldNames.removeAll(Arrays.asList(ignoredFieldNames)); return checkAllFieldsAreBlank(bean, fieldNames); }
From source file:com.github.pjungermann.config.validation.ConfigValidator.java
protected void applyStrictMode(@NotNull final Config config, @NotNull final ConfigSpecification configSpecification) { LOGGER.info("strict mode: check for keys without specification"); final Set<String> keys = new HashSet<>(config.keySet()); keys.removeAll( configSpecification.constraints.stream().parallel().map(Constraint::getKey).collect(toSet())); keys.removeAll(configSpecification.typeConverter.getKeys()); if (!keys.isEmpty()) { config.errors.add(new KeysWithoutSpecificationError(keys)); }//from ww w.j a va 2s. co m }
From source file:org.jasig.i18n.translate.AutoTranslationService.java
public Map<String, String> getAutoUpdatedTranslationMap(Map<String, String> mainMap, Map<String, String> targetMap, String languageKey) { // assemble a set of keys represented in the main map but not in the // target language map Set<String> missing = mainMap.keySet(); missing.removeAll(targetMap.keySet()); // put the keys in a list so that we have a consistent ordering List<String> keys = new ArrayList<String>(); keys.addAll(missing);/* www. j a v a 2s. co m*/ // assemble a list of untranslated messages in the same order as our // missing key list List<String> untranslatedMessages = new ArrayList<String>(); for (String key : keys) { untranslatedMessages.add(mainMap.get(key)); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("key", this.apiKey); parameters.put("source", this.defaultLanguageKey); parameters.put("target", languageKey); parameters.put("query", untranslatedMessages); GoogleTranslationResponse response = this.restTemplate.getForObject(urlTemplate, GoogleTranslationResponse.class, parameters); List<Translation> translations = response.getTranslations(); // iterate through the auto-translations, adding each to the target // map ListIterator<Translation> iter = translations.listIterator(); while (iter.hasNext()) { Translation translation = iter.next(); String key = keys.get(iter.previousIndex()); targetMap.put(key, translation.getTranslatedText()); } return targetMap; }
From source file:org.wallerlab.yoink.adaptive.smooth.DASWeightFactors.java
private void loopOverAllQMMMConfigurationsInBuffer(List<Double> lambda, List<Integer> bufferIndices, Map<List<Integer>, Double> molecularIndicesAndWeightFactor) { Subsets.split(Ints.toArray(bufferIndices)).parallelStream().forEach(qmSet -> { Set<Integer> mmSet = new HashSet<Integer>(bufferIndices); mmSet.removeAll(qmSet); findTheRightConfigurations(lambda, bufferIndices, molecularIndicesAndWeightFactor, qmSet, mmSet); });// w ww . j av a 2 s .com }
From source file:com.yahoo.sql4d.sql4ddriver.BaseJoiner.java
protected void fillHeaders(JSONObject eachRow, List<String> joinFields, ActionType action) { if (action == ActionType.FIRST_CUT) { baseFieldNames.add("timestamp"); }/*from w ww . j av a 2 s.c om*/ if (eachRow != null) { if (isJoinType(action)) { Set<String> keysCopy = new LinkedHashSet<>(eachRow.keySet()); keysCopy.removeAll(joinFields); baseFieldNames.addAll(keysCopy); } else { baseFieldNames.addAll(eachRow.keySet()); } } }
From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java
private Set<String> filterClassifiers(Set<String> srcMasterClassifiers, Set<String> destMasterClassifiers) { Set<String> commonComponentNames = Sets.newLinkedHashSet(); commonComponentNames.addAll(srcMasterClassifiers); commonComponentNames.retainAll(destMasterClassifiers); if (getCommandLine().hasOption("classifiers")) { List<String> classifiersList = Arrays.asList(getCommandLine().getOptionValues("classifiers")); Set<String> classifiers = Sets.newHashSet(); classifiers.addAll(classifiersList); classifiers.removeAll(classifiers); if (classifiers.size() > 0) { System.err.println("Couldn't find classifiers: " + classifiers.toString() + ", skipping those"); }/*from ww w. java 2 s . c o m*/ classifiers.clear(); classifiers.addAll(classifiersList); commonComponentNames.retainAll(classifiers); } return commonComponentNames; }
From source file:br.ufal.cideei.soot.instrument.bitrep.SetBitConfigRep.java
@Override public Pair<ILazyConfigRep, ILazyConfigRep> split(Collection<IConfigRep> belongedConfigs) { Set<IConfigRep> leftSplit = new HashSet<IConfigRep>(configs); leftSplit.removeAll(belongedConfigs); return new Pair<ILazyConfigRep, ILazyConfigRep>(new SetBitConfigRep(leftSplit, atoms, highestId), new SetBitConfigRep(belongedConfigs, atoms, highestId)); }
From source file:br.ufal.cideei.soot.instrument.bitrep.SetBitConfigRep.java
public Pair<ILazyConfigRep, ILazyConfigRep> split(IFeatureRep rep) { Set<IConfigRep> belongsToConfigurations = belongsToConfigurations(rep); Set<IConfigRep> leftSplit = new HashSet<IConfigRep>(configs); leftSplit.removeAll(belongsToConfigurations); return new Pair<ILazyConfigRep, ILazyConfigRep>(new SetBitConfigRep(leftSplit, atoms, highestId), new SetBitConfigRep(belongsToConfigurations, atoms, highestId)); }
From source file:com.retroduction.carma.eventlisteners.SummaryCreatorEventListener.java
/** * this method should be called after tests have been finished * /* w w w .ja v a 2s . co m*/ * @return */ public Summary createSummary() { Summary summary = new Summary(); this.watch.stop(); double elapsed = this.watch.getLastTaskTimeMillis(); Set<String> executedTests = new HashSet<String>(this.testNames); executedTests.removeAll(this.testsNotExecuted); double mutantsPerClass = (double) this.totalMutants.size() / (double) this.numClassesUnderTest; double testsPerClass = (double) executedTests.size() / (double) this.numClassesUnderTest; double coverageRatio = 1.0 - ((double) this.suvivors.size() / (double) this.totalMutants.size()); summary.mutantsPerClass = mutantsPerClass; summary.numClassesUnderTest = this.numClassesUnderTest; summary.numMutants = this.totalMutants.size(); summary.numSurvivors = this.suvivors.size(); summary.numTests = executedTests.size(); summary.coverageRatioPercentage = coverageRatio * 100.0; summary.testsPerClass = testsPerClass; summary.timeSeconds = elapsed / 1000; return summary; }
From source file:fm.last.lastfmlive.service.TwitterClient.java
@Scheduled(fixedDelay = 30000) public void checkTwitter() { if (!twitterEnabled) { return;/* w w w . ja va2 s .c o m*/ } log.info("Checking twitter for new tweets."); Set<Tweet> newTweets = new HashSet<Tweet>(checkForHashTaggedTweets(searchHashTag)); newTweets.removeAll(collectedTweets); collectedTweets.addAll(newTweets); theBrain.addTweets(newTweets); addUsersFromTweets(newTweets); log.info("Tweets found: {}", newTweets.size()); }