本文整理汇总了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;
}
示例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());
}
}
}
示例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;
}
示例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 };
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}