java.util.Collection#contains ( )源码实例Demo

下面列出了java.util.Collection#contains ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: secure-data-service   文件: EntityRightsFilter.java
@SuppressWarnings("unchecked")
protected void filterFields(EntityBody entityBody, Collection<GrantedAuthority> auths, String prefix,
        String entityType) {

    if (!auths.contains(Right.FULL_ACCESS)) {

        List<String> toRemove = new LinkedList<String>();

        for (Iterator<Map.Entry<String, Object>> it = entityBody.entrySet().iterator(); it.hasNext();) {
            String fieldName = it.next().getKey();

            Set<Right> neededRights = rightAccessValidator.getNeededRights(prefix + fieldName, entityType);

            if (!neededRights.isEmpty() && !rightAccessValidator.intersection(auths, neededRights)) {
                it.remove();
            }
        }
    }
}
 
源代码2 项目: javaide   文件: NestedScrollingWidgetDetector.java
private Element findOuterScrollingWidget(Node node, boolean vertical) {
    Collection<String> applicableElements = getApplicableElements();
    while (node != null) {
        if (node instanceof Element) {
            Element element = (Element) node;
            String tagName = element.getTagName();
            if (applicableElements.contains(tagName)
                    && vertical == isVerticalScroll(element)) {
                return element;
            }
        }

        node = node.getParentNode();
    }

    return null;
}
 
源代码3 项目: AsteroidOSSync   文件: Utils.java
public static boolean haveMatchingIds(List<UUID> advertisedIds, Collection<UUID> lookedForIds)
{
	if(lookedForIds != null && !lookedForIds.isEmpty())
	{
		boolean match = false;

		for(int i = 0; i < advertisedIds.size(); i++)
		{
			if(lookedForIds.contains(advertisedIds.get(i)))
			{
				match = true;
				break;
			}
		}

		if(!match)
			return false;
	}

	return true;
}
 
源代码4 项目: iceberg   文件: Schema.java
/**
 * Creates a projection schema for a subset of columns, selected by name.
 * <p>
 * Names that identify nested fields will select part or all of the field's top-level column.
 *
 * @param names a List of String names for selected columns
 * @return a projection schema from this schema, by name
 */
public Schema select(Collection<String> names) {
  if (names.contains(ALL_COLUMNS)) {
    return this;
  }

  Set<Integer> selected = Sets.newHashSet();
  for (String name : names) {
    Integer id = lazyNameToId().get(name);
    if (id != null) {
      selected.add(id);
    }
  }

  return TypeUtil.select(this, selected);
}
 
源代码5 项目: netbeans   文件: AbstractLookupBaseHid.java
/** Items are the same as results.
 */
public void testItemsAndIntances () {
    addInstances (INSTANCES);
    
    Lookup.Result<Object> r = lookup.lookupResult(Object.class);
    Collection<? extends Lookup.Item<?>> items = r.allItems();
    Collection<?> insts = r.allInstances();
    
    if (items.size () != insts.size ()) {
        fail ("Different size of sets");
    }

    for (Lookup.Item<?> item : items) {
        if (!insts.contains (item.getInstance ())) {
            fail ("Intance " + item.getInstance () + " is missing in " + insts);
        }
    }
}
 
源代码6 项目: anthelion   文件: DOMContentUtils.java
public void setConf(Configuration conf) {
  // forceTags is used to override configurable tag ignoring, later on
  Collection<String> forceTags = new ArrayList<String>(1);

  this.conf = conf;
  linkParams.clear();
  linkParams.put("a", new LinkParams("a", "href", 1));
  linkParams.put("area", new LinkParams("area", "href", 0));
  if (conf.getBoolean("parser.html.form.use_action", true)) {
    linkParams.put("form", new LinkParams("form", "action", 1));
    if (conf.get("parser.html.form.use_action") != null)
      forceTags.add("form");
  }
  linkParams.put("frame", new LinkParams("frame", "src", 0));
  linkParams.put("iframe", new LinkParams("iframe", "src", 0));
  linkParams.put("script", new LinkParams("script", "src", 0));
  linkParams.put("link", new LinkParams("link", "href", 0));
  linkParams.put("img", new LinkParams("img", "src", 0));

  // remove unwanted link tags from the linkParams map
  String[] ignoreTags = conf.getStrings("parser.html.outlinks.ignore_tags");
  for ( int i = 0 ; ignoreTags != null && i < ignoreTags.length ; i++ ) {
    if ( ! forceTags.contains(ignoreTags[i]) )
      linkParams.remove(ignoreTags[i]);
  }
}
 
源代码7 项目: find   文件: RelatedConceptsITCase.java
private String clickFirstNewConcept(final Collection<String> existingConcepts,
                                    final Iterable<WebElement> relatedConcepts) {
    for(final WebElement concept : relatedConcepts) {
        final String conceptText = concept.getText();
        if(!existingConcepts.contains(conceptText)) {
            LOGGER.info("Clicking concept " + conceptText);
            concept.click();

            existingConcepts.add(conceptText.toLowerCase());

            return conceptText;
        }
    }

    throw new NoSuchElementException("no new related concepts");
}
 
private boolean isValidOrConstraint(ITypeBinding type,
									Collection<ConstraintVariable> relevantVars,
									CompositeOrTypeConstraint cotc){
	ITypeConstraint[] components= cotc.getConstraints();
	for (int i= 0; i < components.length; i++) {
		if (components[i] instanceof SimpleTypeConstraint) {
			SimpleTypeConstraint sc= (SimpleTypeConstraint) components[i];
			if (relevantVars.contains(sc.getLeft())) { // upper bound
				if (isSubTypeOf(type, findType(sc.getRight())))
					return true;
			} else if (relevantVars.contains(sc.getRight())) { // lower bound
				if (isSubTypeOf(findType(sc.getLeft()), type))
					return true;
			}
		}
	}
	return false;
}
 
private boolean doProjectsFromNotificationMatchConfiguredProjects(AlertNotificationModel notification, Collection<String> configuredProjects, @Nullable String nullablePattern) {
    Collection<String> notificationProjectNames = blackDuckProjectNameExtractor.getProjectNames(getCache(), notification);
    for (String notificationProjectName : notificationProjectNames) {
        if (configuredProjects.contains(notificationProjectName) || (null != nullablePattern && notificationProjectName.matches(nullablePattern))) {
            return true;
        }
    }
    return false;
}
 
源代码10 项目: uima-uimaj   文件: ObjHashSet.java
@Override
public boolean retainAll(Collection<?> c) {
  boolean anyChanged = false;
  Iterator<T> it = iterator();
  while (it.hasNext()) {
    T v = it.next();
    if (!c.contains(v)) {
      anyChanged = true;
      it.remove();
    }
  }
  return anyChanged;
}
 
源代码11 项目: elepy   文件: Permissions.java
public boolean hasPermissions(Collection<String> permissionsToCheck) {
    if (permissionsToCheck.contains(DISABLED)) {
        return false;
    }
    if (grantedPermissions.contains(SUPER_USER) || permissionsToCheck.isEmpty()) {
        return true;
    }

    return permissionsToCheck.stream().allMatch(this::hasPermission);
}
 
public boolean removeAll(Collection coll) {
    boolean modified = false;
    Iterator it = iterator();
    while (it.hasNext()) {
        if (coll.contains(it.next())) {
            it.remove();
            modified = true;
        }
    }
    return modified;
}
 
源代码13 项目: codebuff   文件: AbstractMultimap.java
@Override
public boolean containsValue(@Nullable Object value) {
  for (Collection<V> collection : asMap().values()) {
    if (collection.contains(value)) {
      return true;
    }
  }

  return false;
}
 
源代码14 项目: Pydev   文件: InterpreterInfo.java
/**
 * Add additions that are not already in col
 */
private static void addUnique(Collection<String> col, Collection<String> additions) {
    for (String string : additions) {
        if (!col.contains(string)) {
            col.add(string);
        }
    }
}
 
源代码15 项目: kylin-on-parquet-v2   文件: QueryInterceptor.java
private void intercept(List<OLAPContext> contexts, Collection<String> blackList) {
    if (blackList.isEmpty()) {
        return;
    }

    Collection<String> queryCols = getQueryIdentifiers(contexts);
    for (String id : blackList) {
        if (queryCols.contains(id.toUpperCase(Locale.ROOT))) {
            throw new AccessDeniedException(getIdentifierType() + ":" + id);
        }
    }
}
 
源代码16 项目: birt   文件: DataRequestSessionImpl.java
protected void validateBindings( List<IBinding> bindings,
		Collection calculatedMeasures ) throws AdapterException
{
	// Not support aggregation filter reference calculated measures.
	try
	{
		for ( IBinding b : bindings )
		{
			if ( b.getAggrFunction( ) == null || b.getFilter( ) == null )
				continue;
			
			List referencedMeasures = ExpressionCompilerUtil.extractColumnExpression( b.getFilter( ),
					ExpressionUtil.MEASURE_INDICATOR );
			for ( Object r : referencedMeasures )
			{
				if ( calculatedMeasures.contains( r.toString( ) ) )
				{
					throw new AdapterException( AdapterResourceHandle.getInstance( )
							.getMessage( ResourceConstants.CUBE_AGGRFILTER_REFER_CALCULATEDMEASURE,
									new Object[]{
											b.getBindingName( ),
											r.toString( )
									} ) );
				}
			}
		}
	}
	catch ( DataException ex )
	{
		throw new AdapterException( ex.getMessage( ), ex );
	}
}
 
源代码17 项目: Dashchan   文件: ChanManager.java
private void invalidateChansOrder() {
	ArrayList<String> orderedChanNames = Preferences.getChansOrder();
	if (orderedChanNames != null) {
		Collection<String> oldAvailableChanNames = availableChanNames;
		availableChanNames = new LinkedHashSet<>();
		for (String chanName : orderedChanNames) {
			if (oldAvailableChanNames.contains(chanName)) {
				availableChanNames.add(chanName);
			}
		}
		availableChanNames.addAll(oldAvailableChanNames);
	}
}
 
源代码18 项目: j2objc   文件: ReferenceGraph.java
private ReferenceGraph getSubgraph(Collection<TypeNode> vertices) {
  ReferenceGraph subgraph = new ReferenceGraph();
  for (TypeNode type : vertices) {
    for (Edge e : edges.get(type)) {
      if (vertices.contains(e.getTarget())) {
        subgraph.addEdge(e);
      }
    }
  }
  return subgraph;
}
 
/**
* @generated
*/
protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
	return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
}
 
源代码20 项目: spring-boot   文件: Test.java
public Object copyBeanProperties(final Object source, final Collection<String> includes) {

        final Collection<String> excludes = new ArrayList<String>();
        final PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(source.getClass());

        Object entityBeanVO = BeanUtils.instantiate(source.getClass());

        for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {

            String propName = propertyDescriptor.getName();
            if (!includes.contains(propName)) {
                excludes.add(propName);
            }


        }

        BeanUtils.copyProperties(source, entityBeanVO, excludes.toArray(new String[excludes.size()]));

        return entityBeanVO;
    }