當前位置: 首頁>>代碼示例>>Java>>正文


Java Set.removeIf方法代碼示例

本文整理匯總了Java中java.util.Set.removeIf方法的典型用法代碼示例。如果您正苦於以下問題:Java Set.removeIf方法的具體用法?Java Set.removeIf怎麽用?Java Set.removeIf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Set的用法示例。


在下文中一共展示了Set.removeIf方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: get

import java.util.Set; //導入方法依賴的package包/類
@Override
public Set<MultifactorAuthenticationTrustRecord> get(final String principal, final LocalDate onOrAfterDate) {
    final Set<MultifactorAuthenticationTrustRecord> res = get(principal);
    res.removeIf(entry -> {
        if (entry.getDate().isBefore(onOrAfterDate)) {
            return true;
        }
        final String decodedKey = this.cipherExecutor.decode(entry.getKey());
        final String currentKey = MultifactorAuthenticationTrustUtils.generateKey(entry);
        if (StringUtils.isBlank(decodedKey)) {
            return true;
        }
        return !decodedKey.equals(currentKey);
    });
    return res;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:17,代碼來源:BaseMultifactorAuthenticationTrustStorage.java

示例2: filterEventsByMultifactorAuthenticationProvider

import java.util.Set; //導入方法依賴的package包/類
/**
 * Filter events by multifactor authentication providers.
 *
 * @param resolveEvents     the resolve events
 * @param authentication    the authentication
 * @param registeredService the registered service
 * @return the set of events
 */
protected Pair<Set<Event>, Collection<MultifactorAuthenticationProvider>> filterEventsByMultifactorAuthenticationProvider(
        final Set<Event> resolveEvents, final Authentication authentication, final RegisteredService registeredService) {
    LOGGER.debug("Locating multifactor providers to determine support for this authentication sequence");
    final Map<String, MultifactorAuthenticationProvider> providers =
            WebUtils.getAvailableMultifactorAuthenticationProviders(applicationContext);

    if (providers == null || providers.isEmpty()) {
        LOGGER.debug("No providers are available to honor this request. Moving on...");
        return Pair.of(resolveEvents, Collections.emptySet());
    }

    final Collection<MultifactorAuthenticationProvider> flattenedProviders = flattenProviders(providers.values());

    // remove providers that don't support the event
    flattenedProviders.removeIf(p -> resolveEvents.stream().filter(e -> p.supports(e, authentication, registeredService)).count() == 0);

    // remove events that are not supported by providers.
    resolveEvents.removeIf(e -> flattenedProviders.stream().filter(p -> p.supports(e, authentication, registeredService)).count() == 0);

    LOGGER.debug("Finalized set of resolved events are [{}]", resolveEvents);
    return Pair.of(resolveEvents, flattenedProviders);
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:31,代碼來源:SelectiveAuthenticationProviderWebflowEventEventResolver.java

示例3: onTimerPostExecute

import java.util.Set; //導入方法依賴的package包/類
/**
 * That method is executed right after notification to {@link IEventTimerEvent#onTimerEvent(TimerHolder)} in order to remove the holder from the _timers map
 * @param holder
 */
public void onTimerPostExecute(TimerHolder<T> holder)
{
	// Remove non repeating timer upon execute
	if (!holder.isRepeating())
	{
		final Set<TimerHolder<T>> timers = _timers.get(holder.getEvent());
		if ((timers == null) || timers.isEmpty())
		{
			return;
		}
		
		// Remove the timer
		timers.removeIf(holder::equals);
		
		// If there's no events inside that set remove it
		if (timers.isEmpty())
		{
			_timers.remove(holder.getEvent());
		}
	}
}
 
開發者ID:rubenswagner,項目名稱:L2J-Global,代碼行數:26,代碼來源:TimerExecutor.java

示例4: getRequiredPlayerCount

import java.util.Set; //導入方法依賴的package包/類
private int getRequiredPlayerCount(World world) {
    // TODO: Automatically add exclusions for vanished players -- requires Nucleus to provide some sort of API for that
    Set<Player> players = new HashSet<>(world.getPlayers());
    players.removeIf(this::isIgnored);

    int requiredFromPercent = (int) (players.size() * requiredPercentSleeping);

    int required;
    if (requiredNumberSleeping <= 0) {
        required = requiredFromPercent;
    } else {
        required = Math.min(requiredFromPercent, requiredNumberSleeping);
    }

    return required < 1 ? 1 : required;
}
 
開發者ID:Icohedron,項目名稱:SleepVote,代碼行數:17,代碼來源:SleepVoteManager.java

示例5: restrictedIndexes

import java.util.Set; //導入方法依賴的package包/類
/**
 * [0] are indexes allowed to be selected for the class data
 * [1] are indexes that will allow use of the extra multiplier car flag
 * @param all the full list of indexes
 * @return two sets of indexes allowed in particular situations.
 */
@SuppressWarnings("rawtypes")
public Set[] restrictedIndexes(Collection<Index> all)
{
    Set<Index> allindexes = new HashSet<Index>(all);
    allindexes.removeIf(i -> i.indexcode.equals(""));

    if (caridxrestrict.trim().isEmpty())
    {
        return new Set[] { allindexes, allindexes };
    }
    else
    {
        String full = caridxrestrict.replace(" ", "");
        Set<Index> indexrestrict = processList(RINDEX.matcher(full), allindexes);
        Set<Index> flagrestrict = processList(RFLAG.matcher(full), allindexes);
        return new Set[] { indexrestrict, flagrestrict };
    }

}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:26,代碼來源:ClassData.java

示例6: initialize

import java.util.Set; //導入方法依賴的package包/類
/**
 * Initialize the handler, setup the authentication entry attributes.
 */
@PostConstruct
public void initialize() {
    /*
     * Use a set to ensure we ignore duplicates.
     */
    final Set<String> attributes = new HashSet<>();

    LOGGER.debug("Initializing LDAP attribute configuration...");
    if (StringUtils.isNotBlank(this.principalIdAttribute)) {
        LOGGER.debug("Configured to retrieve principal id attribute [{}]", this.principalIdAttribute);
        attributes.add(this.principalIdAttribute);
    }
    if (this.principalAttributeMap != null && !this.principalAttributeMap.isEmpty()) {
        final Set<String> attrs = this.principalAttributeMap.keySet();
        attributes.addAll(attrs);
        LOGGER.debug("Configured to retrieve principal attribute collection of [{}]", attrs);
    }

    if (authenticator.getReturnAttributes() != null) {
        final List<String> authenticatorAttributes = Arrays.asList(authenticator.getReturnAttributes());
        if (authenticatorAttributes != null && !authenticatorAttributes.isEmpty()) {
            LOGGER.debug("Filtering authentication entry attributes [{}] based on authenticator attributes [{}]",
                    authenticatedEntryAttributes, authenticatorAttributes);
            attributes.removeIf(authenticatorAttributes::contains);
        }
    }
    this.authenticatedEntryAttributes = attributes.toArray(new String[attributes.size()]);
    LOGGER.debug("LDAP authentication entry attributes for the authentication request are [{}]",
            (Object[]) this.authenticatedEntryAttributes);
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:34,代碼來源:LdapAuthenticationHandler.java

示例7: filterMissingClasses

import java.util.Set; //導入方法依賴的package包/類
private Set<DexType> filterMissingClasses(Set<DexType> missingClasses,
    Set<ProguardTypeMatcher> dontWarnPatterns) {
  Set<DexType> result = new HashSet<>(missingClasses);
  for (ProguardTypeMatcher matcher : dontWarnPatterns) {
    if (matcher instanceof MatchSpecificType) {
      result.remove(((MatchSpecificType) matcher).type);
    } else {
      result.removeIf(matcher::matches);
    }
  }
  return result;
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:13,代碼來源:R8.java

示例8: generalizeSet

import java.util.Set; //導入方法依賴的package包/類
private Set<Set<ColumnIdentifier>> generalizeSet(Set<Set<ColumnIdentifier>> possibleSmallerIND) {
  Set<Set<ColumnIdentifier>> generalizedINDs = new HashSet<>();
  for(Set<ColumnIdentifier> indNode : possibleSmallerIND) {
    Set<Set<ColumnIdentifier>> powerSet = new HashSet<>(Sets.powerSet(indNode));
    powerSet.removeIf(x -> x.size() != indNode.size() - 1);
    generalizedINDs.addAll(powerSet);
  }
  return generalizedINDs;
}
 
開發者ID:HPI-Information-Systems,項目名稱:AdvancedDataProfilingSeminar,代碼行數:10,代碼來源:Zigzag.java

示例9: getAllExecutedModelResources

import java.util.Set; //導入方法依賴的package包/類
private Set<Resource> getAllExecutedModelResources() {
	Set<Resource> allResources = new HashSet<>();
	allResources.add(executedModel);
	allResources.addAll(org.eclipse.gemoc.commons.eclipse.emf.EMFResource.getRelatedResources(executedModel));
	allResources.removeIf(r -> r == null);
	return allResources;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:8,代碼來源:GenericTraceConstructor.java

示例10: getNGram

import java.util.Set; //導入方法依賴的package包/類
@Override
public Set<String> getNGram(String text) {
  if (text == null) {
    text = "";
  }

  // get all words and digits
  String[] words = text.toLowerCase().split("[ \\pP\n\t\r$+<>№=]");

  Set<String> uniqueValues = new LinkedHashSet<>(Arrays.asList(words));
  uniqueValues.removeIf(s -> s.equals(""));

  return uniqueValues;
}
 
開發者ID:RusZ,項目名稱:TextClassifier,代碼行數:15,代碼來源:Unigram.java

示例11: getNGram

import java.util.Set; //導入方法依賴的package包/類
@Override
public Set<String> getNGram(String text) {
  // get all significant words
  String[] words = clean(text).split("[ \n\t\r$+<>№=]");

  // remove endings of words
  for (int i = 0; i < words.length; i++) {
    words[i] = PorterStemmer.doStem(words[i]);
  }

  Set<String> uniqueValues = new LinkedHashSet<>(Arrays.asList(words));
  uniqueValues.removeIf(s -> s.equals(""));

  return uniqueValues;
}
 
開發者ID:RusZ,項目名稱:TextClassifier,代碼行數:16,代碼來源:FilteredUnigram.java

示例12: getAllExecutedModelResources

import java.util.Set; //導入方法依賴的package包/類
private Set<Resource> getAllExecutedModelResources() {
	Set<Resource> allResources = new HashSet<>();
	allResources.add(executedModel);
	allResources.addAll(org.eclipse.gemoc.commons.eclipse.emf.EMFResource.getRelatedResources(executedModel));
	allResources.removeIf(
			r -> r == null || (r != executedModel && executedModel.getContents().contains(r.getContents().get(0))));
	return allResources;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:9,代碼來源:FsmTraceConstructor.java

示例13: verzamelDatumAanvangAttributen

import java.util.Set; //導入方法依賴的package包/類
private Set<MetaAttribuut> verzamelDatumAanvangAttributen(final Persoonslijst persoonslijst) {
    final Set<MetaAttribuut> alleAttributen = Sets.newHashSet();
    final ModelIndex modelIndex = persoonslijst.getModelIndex();
    for (Element element : DATUM_AANVANG_ATTRIBUUT_SET) {
        alleAttributen.addAll(modelIndex.geefAttributen(element));
    }
    // Alleen attributen uit actuele records worden meegenomen met pre-relatie filtering.
    alleAttributen.removeIf(attr -> !persoonslijst.isActueel(attr.getParentRecord()));
    return alleAttributen;
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:11,代碼來源:BepaalPreRelatieGegevensServiceImpl.java

示例14: getSqlParams

import java.util.Set; //導入方法依賴的package包/類
/**
 * SQLパラメータの解析
 *
 * @param sql 解析対象SQL
 * @return SQLを解析して取得したパラメータキーのセット
 */
private Set<String> getSqlParams(final String sql) {
	SqlParser parser = new SqlParserImpl(sql);
	ContextTransformer transformer = parser.parse();
	Node rootNode = transformer.getRoot();

	Set<String> params = new LinkedHashSet<String>();
	traverseNode(rootNode, params);

	params.removeIf(s -> CONSTANT_PAT.matcher(s).matches());

	return params;
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:19,代碼來源:SqlREPL.java

示例15: getModulesJVMTI

import java.util.Set; //導入方法依賴的package包/類
private static Set<Module> getModulesJVMTI() {

        Set<Module> modules = Arrays.stream(getModulesNative()).collect(Collectors.toSet());

        // JVMTI reports unnamed modules, Java API does not
        // remove the unnamed modules here, so the resulting report can be expected
        // to be equal to what Java reports
        modules.removeIf(mod -> !mod.isNamed());

        return modules;
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:JvmtiGetAllModulesTest.java


注:本文中的java.util.Set.removeIf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。