当前位置: 首页>>代码示例>>Java>>正文


Java Set.contains方法代码示例

本文整理汇总了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);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:28,代码来源:CMSClient.java

示例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() );
			}
		}
	}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:Configuration.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BreakpointGroup.java

示例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);
        }
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:24,代码来源:BerichtRestrictieStap.java

示例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.");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SmallEnumIteratorRemoveResilience.java

示例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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:TransformerConfigImpl.java

示例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");
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:32,代码来源:GetIconsCSS.java

示例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;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:15,代码来源:AttributeMatcher.java

示例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;
}
 
开发者ID:andrew-bedford,项目名称:coqatoo,代码行数:10,代码来源:SetHelper.java

示例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);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:HStoreConf.java

示例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;
}
 
开发者ID:DSC-SPIDAL,项目名称:twister2,代码行数:12,代码来源:TaskPlanUtils.java

示例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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:HelpSetRegistrationProcessor.java

示例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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:16,代码来源:DefaultServerEndpointConfigurator.java

示例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;
}
 
开发者ID:kfrozen,项目名称:DeeplinkRouter,代码行数:36,代码来源:Mapping.java

示例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;
}
 
开发者ID:uber,项目名称:NullAway,代码行数:42,代码来源:NullAway.java


注:本文中的java.util.Set.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。