本文整理汇总了Java中java.util.Set.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Set.contains方法的具体用法?Java Set.contains怎么用?Java Set.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Set
的用法示例。
在下文中一共展示了Set.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: incExecOrder
import java.util.Set; //导入方法依赖的package包/类
/**
* Inc exec order.
*
* @param exec the exec
*/
public void incExecOrder(DelegateExecution exec) {
Integer newExecOrder = (Integer) exec.getVariable(CmsConstants.EXEC_ORDER) + 1;
if (exec.hasVariable(DPMT)) {
CmsDeployment dpmt = (CmsDeployment) exec.getVariable(DPMT);
Set<Integer> autoPauseExecOrders = dpmt.getAutoPauseExecOrders();
if (autoPauseExecOrders != null && autoPauseExecOrders.contains(newExecOrder)) {
logger.info("pausing deployment " + dpmt.getDeploymentId() + " before step " + newExecOrder);
CmsDeployment clone = new CmsDeployment(); // cannot update existing instance need to clone deployment first
clone.setDeploymentId(dpmt.getDeploymentId());
clone.setDeploymentState(PAUSED);
clone.setUpdatedBy(ONEOPS_SYSTEM_USER);
clone.setComments("deployment paused at step " + newExecOrder + " on " + new Date());
try {
cmsDpmtProcessor.updateDeployment(clone);
} catch (CmsBaseException e) {
logger.error("CmsBaseException in incExecOrder", e);
throw e;
}
}
}
exec.setVariable(CmsConstants.EXEC_ORDER, newExecOrder);
}
示例2: secondPassCompileForeignKeys
import java.util.Set; //导入方法依赖的package包/类
private void secondPassCompileForeignKeys(Table table, Set done) throws MappingException {
Iterator iter = table.getForeignKeyIterator();
while ( iter.hasNext() ) {
ForeignKey fk = (ForeignKey) iter.next();
if ( !done.contains(fk) ) {
done.add(fk);
if ( log.isDebugEnabled() ) log.debug(
"resolving reference to class: " + fk.getReferencedClass().getName()
);
PersistentClass referencedClass = (PersistentClass) classes.get( fk.getReferencedClass() );
if (referencedClass == null) throw new MappingException(
"An association from the table " +
fk.getTable().getName() +
" refers to an unmapped class: " +
fk.getReferencedClass().getName()
);
if ( referencedClass.isJoinedSubclass() ) {
secondPassCompileForeignKeys( referencedClass.getSuperclass().getTable(), done );
}
fk.setReferencedTable( referencedClass.getTable() );
}
}
}
示例3: isOpened
import java.util.Set; //导入方法依赖的package包/类
private static boolean isOpened(Project[] projects,
Set<Project> openedProjectsCache,
Set<Project> closedProjectsCache,
Map<Project, Set<? extends Project>> subProjects) {
if (projects != null && projects.length > 0) {
for (Project p : projects) {
if (p == null) {
return true;
}
if (openedProjectsCache.contains(p)) {
return true;
}
if (closedProjectsCache.contains(p)) {
return false;
}
if (OpenProjects.getDefault().isProjectOpen(p) ||
isDependentOnAnOpened(p, openedProjectsCache, closedProjectsCache, subProjects)) {
return true;
}
}
return false;
} else {
return true;
}
}
示例4: execute
import java.util.Set; //导入方法依赖的package包/类
@Override
public void execute(final Berichtgegevens berichtgegevens) {
final SoortDienst soortDienst = berichtgegevens.getAutorisatiebundel().getSoortDienst();
final SoortBericht soortBericht = dienstMetRestrictie.get(soortDienst);
if (soortBericht == null) {
return;
}
//verwijder objecten
final Set<ObjectElement> teBehoudenObjecten = objectenInBericht.get(soortBericht);
for (final MetaObject metaObject : berichtgegevens.getGeautoriseerdeObjecten()) {
if (!teBehoudenObjecten.contains(metaObject.getObjectElement())) {
berichtgegevens.verwijderAutorisatie(metaObject);
}
}
//verwijder groepen
final Set<GroepElement> teBehoudenGroepen = groepenInBericht.get(soortBericht);
for (final MetaGroep groep : berichtgegevens.getGeautoriseerdeGroepen()) {
if (!teBehoudenGroepen.contains(groep.getGroepElement())) {
berichtgegevens.verwijderAutorisatie(groep);
}
}
}
示例5: checkSetAfterRemoval
import java.util.Set; //导入方法依赖的package包/类
private static void checkSetAfterRemoval(final Set<SmallEnum> set,
final int origSize, final SmallEnum removedElement)
throws Exception {
if (set.size() != (origSize - 1)) {
throw new Exception("Test FAILED: Unexpected set size after removal; expected '" + (origSize - 1) + "' but found '" + set.size() + "'");
}
if (set.contains(removedElement)) {
throw new Exception("Test FAILED: Element returned from iterator unexpectedly still in set after removal.");
}
}
示例6: strictMimetypeCheck
import java.util.Set; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean strictMimetypeCheck(String declaredMimetype, String detectedMimetype)
{
if (detectedMimetype == null)
{
return true;
}
Set<String> detectedMimetypes = strictMimetypeExceptions.get(declaredMimetype);
return detectedMimetypes != null && detectedMimetypes.contains(detectedMimetype);
}
示例7: writeResponseResult
import java.util.Set; //导入方法依赖的package包/类
@Override
protected void writeResponseResult(HttpServletRequest request, HttpServletResponse response) throws Exception {
Document pluginDocument = Get.getPluginDocument();
TwsCachedXPathAPI xpathApi = new TwsCachedXPathAPI();
List<Node> nActions = xpathApi.selectList(pluginDocument, "/plugin/extension[@point='org.eclipse.ui.popupMenus']//action[@icon]");
Set<String> actionIconAttrs = new HashSet<>();
StringBuilder sb = new StringBuilder();
for (Node nAction: nActions) {
Element eAction = (Element) nAction;
String attrIcon = eAction.getAttribute("icon");
if (!actionIconAttrs.contains(actionIconAttrs)) {
sb.append(".")
.append(eAction.getAttribute("id").replaceAll("\\.", "-"))
.append(" {background-image:url(")
.append("../../admin/services/studio.menu.GetIcon?iconPath=")
.append(attrIcon)
.append(") !important;")
.append("}\r\n");
actionIconAttrs.add(attrIcon);
}
}
response.setContentType(MimeType.Css.value());
IOUtils.write(sb.toString(), response.getOutputStream(), "UTF-8");
}
示例8: single
import java.util.Set; //导入方法依赖的package包/类
/**
* Returns true if attribute value is present in the source attribute values.
*
* @param sourceAttributes
* @param attributeValue
* @return
*/
public boolean single(final Set<String> sourceAttributes, final String attributeValue) {
boolean match = false;
if (sourceAttributes != null && !sourceAttributes.isEmpty()) {
match = sourceAttributes.contains(attributeValue);
}
return match;
}
示例9: intersection
import java.util.Set; //导入方法依赖的package包/类
public static <T> Set<T> intersection(Set<T> setA, Set<T> setB) {
Set<T> tmp = new HashSet<T>();
for (T x : setA) {
if (setB.contains(x)) {
tmp.add(x);
}
}
return tmp;
}
示例10: isMarkedExternal
import java.util.Set; //导入方法依赖的package包/类
/**
* Returns true if this parameter was set manually from an external source
* @param handle
* @param f_name
* @return
*/
protected boolean isMarkedExternal(Conf handle, String f_name) {
Set<String> s = this.externalParams.get(handle);
boolean ret = (s != null && s.contains(f_name));
if (debug.val)
LOG.debug(String.format("Checking whether %s.%s is externally set: %s",
handle.prefix, f_name, ret));
return (ret);
}
示例11: getTasksOfThisExecutor
import java.util.Set; //导入方法依赖的package包/类
public static Set<Integer> getTasksOfThisExecutor(TaskPlan plan, Set<Integer> tasks) {
Set<Integer> allTasksOfThisExec = plan.getTasksOfThisExecutor();
Set<Integer> tasksOfThisExec = new HashSet<>();
for (int t : tasks) {
if (allTasksOfThisExec.contains(t)) {
tasksOfThisExec.add(t);
}
}
return tasksOfThisExec;
}
示例12: scan
import java.util.Set; //导入方法依赖的package包/类
private static void scan(File d, PrintWriter pw, AtomicInteger cnt, Set<String> excludes, String path) {
for (File f : d.listFiles()) {
String name = f.getName();
if (f.isDirectory()) {
scan(f, pw, cnt, excludes, path + name + '/');
} else if (!excludes.contains(path + name) && name.matches(".+[.]html?$")) {
pw.println("File " + f);
cnt.incrementAndGet();
}
}
}
示例13: getNegotiatedExtensions
import java.util.Set; //导入方法依赖的package包/类
@Override
public List<Extension> getNegotiatedExtensions(List<Extension> installed,
List<Extension> requested) {
Set<String> installedNames = new HashSet<String>();
for (Extension e : installed) {
installedNames.add(e.getName());
}
List<Extension> result = new ArrayList<Extension>();
for (Extension request : requested) {
if (installedNames.contains(request.getName())) {
result.add(request);
}
}
return result;
}
示例14: isMatched
import java.util.Set; //导入方法依赖的package包/类
public boolean isMatched(String url)
{
if(TextUtils.isEmpty(url)) return false;
Uri uri = Uri.parse(url);
String host = uri.getHost();
if(!TextUtils.isEmpty(host) && TextUtils.equals(this.host, host))
{
if(paramsFilter.isEmpty())
{
return true;
}
else
{
Set<String> queryKeySet = uri.getQueryParameterNames();
if(queryKeySet.isEmpty()) return false;
boolean isAllParamsMatched = true;
for(String paramKey : paramsFilter.keySet())
{
isAllParamsMatched = isAllParamsMatched
&& queryKeySet.contains(paramKey)
&& TextUtils.equals(paramsFilter.get(paramKey), uri.getQueryParameter(paramKey));
}
return isAllParamsMatched;
}
}
return false;
}
示例15: notAssignedInAnyInitializer
import java.util.Set; //导入方法依赖的package包/类
/**
* @param entities relevant entities from class
* @param notInitializedInConstructors those fields not initialized in some constructor
* @param state
* @return those fields from notInitializedInConstructors that are not initialized in any
* initializer method
*/
private Set<Symbol> notAssignedInAnyInitializer(
FieldInitEntities entities, Set<Symbol> notInitializedInConstructors, VisitorState state) {
Trees trees = Trees.instance(JavacProcessingEnvironment.instance(state.context));
Symbol.ClassSymbol classSymbol = entities.classSymbol();
Set<Element> initInSomeInitializer = new LinkedHashSet<>();
for (MethodTree initMethodTree : entities.instanceInitializerMethods()) {
if (initMethodTree.getBody() == null) {
continue;
}
addInitializedFieldsForBlock(
state,
trees,
classSymbol,
initInSomeInitializer,
initMethodTree.getBody(),
new TreePath(state.getPath(), initMethodTree));
}
for (BlockTree block : entities.instanceInitializerBlocks()) {
addInitializedFieldsForBlock(
state,
trees,
classSymbol,
initInSomeInitializer,
block,
new TreePath(state.getPath(), block));
}
Set<Symbol> result = new LinkedHashSet<>();
for (Symbol fieldSymbol : notInitializedInConstructors) {
if (!initInSomeInitializer.contains(fieldSymbol)) {
result.add(fieldSymbol);
}
}
return result;
}