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


Java LinkedHashSet.add方法代码示例

本文整理汇总了Java中java.util.LinkedHashSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashSet.add方法的具体用法?Java LinkedHashSet.add怎么用?Java LinkedHashSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedHashSet的用法示例。


在下文中一共展示了LinkedHashSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getToolingImpl

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private ClassPath getToolingImpl() {
    if (!gradleHomeDir.exists()) {
        throw new IllegalArgumentException(String.format("The specified %s does not exist.", locationDisplayName));
    }
    if (!gradleHomeDir.isDirectory()) {
        throw new IllegalArgumentException(String.format("The specified %s is not a directory.", locationDisplayName));
    }
    File libDir = new File(gradleHomeDir, "lib");
    if (!libDir.isDirectory()) {
        throw new IllegalArgumentException(String.format("The specified %s does not appear to contain a Gradle distribution.", locationDisplayName));
    }
    LinkedHashSet<File> files = new LinkedHashSet<File>();
    for (File file : libDir.listFiles()) {
        if (hasExtension(file, ".jar")) {
            files.add(file);
        }
    }
    return new DefaultClassPath(files);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:DistributionFactory.java

示例2: generateKey

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Key for a cache object is built from all the known Authorities (which can change dynamically so they must all be
 * used) the NodeRef ID and the permission reference itself. This gives a unique key for each permission test.
 */
Serializable generateKey(Set<String> auths, NodeRef nodeRef, PermissionReference perm, CacheType type)
{
    LinkedHashSet<Serializable> key = new LinkedHashSet<Serializable>();
    key.add(perm.toString());
    // We will just have to key our dynamic sets by username. We wrap it so as not to be confused with a static set
    if (auths instanceof AuthorityServiceImpl.UserAuthoritySet)
    {
        key.add((Serializable)Collections.singleton(((AuthorityServiceImpl.UserAuthoritySet)auths).getUsername()));
    }
    else
    {
        key.addAll(auths);            
    }        
    key.add(nodeRef);
    // Ensure some concept of node version or transaction is included in the key so we can track without cache replication 
    NodeRef.Status nodeStatus = nodeService.getNodeStatus(nodeRef);
    key.add(nodeStatus == null ? "null" : nodeStatus.getChangeTxnId());
    key.add(type);
    return key;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:PermissionServiceImpl.java

示例3: getResources

import java.util.LinkedHashSet; //导入方法依赖的package包/类
@Override
public Enumeration<URL> getResources(String name) throws IOException {
	final LinkedHashSet<URL> resourceUrls = new LinkedHashSet<URL>();

	for ( ClassLoader classLoader : individualClassLoaders ) {
		final Enumeration<URL> urls = classLoader.getResources( name );
		while ( urls.hasMoreElements() ) {
			resourceUrls.add( urls.nextElement() );
		}
	}

	return new Enumeration<URL>() {
		final Iterator<URL> resourceUrlIterator = resourceUrls.iterator();

		@Override
		public boolean hasMoreElements() {
			return resourceUrlIterator.hasNext();
		}

		@Override
		public URL nextElement() {
			return resourceUrlIterator.next();
		}
	};
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:ClassLoaderServiceImpl.java

示例4: setProjectedRowType

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private void setProjectedRowType(List<SchemaPath> projectedColumns){
  if(projectedColumns != null){
    LinkedHashSet<String> firstLevelPaths = new LinkedHashSet<>();
    for(SchemaPath p : projectedColumns){
      firstLevelPaths.add(p.getRootSegment().getNameSegment().getPath());
    }

    final RelDataTypeFactory factory = getCluster().getTypeFactory();
    final FieldInfoBuilder builder = new FieldInfoBuilder(factory);
    final Map<String, RelDataType> fields = new HashMap<>();
    for(Field field : getBatchSchema()){
      if(firstLevelPaths.contains(field.getName())){
        fields.put(field.getName(), CompleteType.fromField(field).toCalciteType(factory));
      }
    }

    Preconditions.checkArgument(firstLevelPaths.size() == fields.size(), "Projected column base size %d is not equal to outcome rowtype %d.", firstLevelPaths.size(), fields.size());

    for(String path : firstLevelPaths){
      builder.add(path, fields.get(path));
    }
    this.rowType = builder.build();
  } else {
    this.rowType = deriveRowType();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:ScanRelBase.java

示例5: includeAdditionsSuperInterfaces2

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Adds all super-interfaces of pivot to acceptor except those listed in exclude
 *
 * @param acceptor
 *            list to add to
 * @param exclude
 *            exclusion set
 * @param pivot
 *            interface providing super-interfaces
 */
private <T extends TClassifier> void includeAdditionsSuperInterfaces2(LinkedHashSet<T> acceptor,
		LinkedHashSet<T> exclude, T pivot, Class<T> castGuard) {
	for (ParameterizedTypeRef superApiClassifier : pivot.getSuperClassifierRefs()) {
		Type superApiDeclaredType = superApiClassifier.getDeclaredType();
		if (castGuard.isAssignableFrom(superApiDeclaredType.getClass())) {
			@SuppressWarnings("unchecked")
			T superInterface = (T) superApiClassifier.getDeclaredType();
			if (!exclude.contains(superInterface)) {
				acceptor.add(superInterface);
			}
		} else {
			// should we handle this or gracefully skip for broken models?
			if (logger.isDebugEnabled()) {
				logger.debug("Oopss ... Casting could not be performed Guard = " + castGuard.getName()
						+ " DeclaredType of superApiClassifier '" + superApiDeclaredType.getClass().getName()
						+ "' ");
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:ScriptApiTracker.java

示例6: create

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * 
 */
public static Condition create(String[] nameList) throws ConditionException {
    if (nameList == null) {
        throw new ConditionException("name list may not be null");
    }
    
    if (nameList.length == 0) {
        throw new ConditionException("name list may not be empty");
    }
    
    if (nameList.length == 1) {
        return new Condition(new String[]{normalize(checkName(nameList[0]))});
    }
    
    LinkedHashSet<String> nameSet = new LinkedHashSet<>();
    
    for (int i=0;i<nameList.length;i++) {
        nameSet.add(normalize(checkName(nameList[i])));
    }
    
    return new Condition(nameSet.toArray(SystemToolkit.EMPTY_STRING_ARRAY));
}
 
开发者ID:annoflex,项目名称:annoflex,代码行数:25,代码来源:Condition.java

示例7: ForwardedUserFilter

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public ForwardedUserFilter(String headerName,
                           Function<HttpServletRequest, User> userFactory,
                           Collection<String> requestAttributeNames) {
    Assert.hasText(headerName, "headerName cannot be null or empty.");
    Assert.notNull(userFactory, "userFactory function cannot be null.");

    this.headerName = headerName;
    this.userFactory = userFactory;

    //always ensure that the fully qualified interface name is accessible:
    LinkedHashSet<String> set = new LinkedHashSet<>();
    set.add(User.class.getName());
    if (!Collections.isEmpty(requestAttributeNames)) {
        set.addAll(requestAttributeNames);
    }
    this.requestAttributeNames = set;
}
 
开发者ID:juiser,项目名称:juiser,代码行数:18,代码来源:ForwardedUserFilter.java

示例8: filterPolicySetsByPriority

import java.util.LinkedHashSet; //导入方法依赖的package包/类
LinkedHashSet<PolicySet> filterPolicySetsByPriority(final String subjectIdentifier, final String uri,
        final List<PolicySet> allPolicySets, final LinkedHashSet<String> policySetsEvaluationOrder)
        throws IllegalArgumentException {

    if (policySetsEvaluationOrder.isEmpty()) {
        if (allPolicySets.size() > 1) {
            LOGGER.error(
                    "Found more than one policy set during policy evaluation and "
                            + "no evaluation order is provided. subjectIdentifier='{}', resourceURI='{}'",
                    subjectIdentifier, uri);
            throw new IllegalArgumentException("More than one policy set exists for this zone. "
                    + "Please provide an ordered list of policy set names to consider for this evaluation and "
                    + "resubmit the request.");
        } else {
            return new LinkedHashSet<>(allPolicySets);
        }
    }

    Map<String, PolicySet> allPolicySetsMap = allPolicySets.stream()
            .collect(Collectors.toMap(PolicySet::getName, Function.identity()));
    LinkedHashSet<PolicySet> filteredPolicySets = new LinkedHashSet<>();
    for (String policySetId : policySetsEvaluationOrder) {
        PolicySet policySet = allPolicySetsMap.get(policySetId);
        if (policySet == null) {
            LOGGER.error("No existing policy set matches policy set in the evaluation order of the request. "
                    + "Subject: {}, Resource: {}", subjectIdentifier, uri);
            throw new IllegalArgumentException(
                    "No existing policy set matches policy set in the evaluaion order of the request. "
                            + "Please review the policy evauation order and resubmit the request.");
        } else {
            filteredPolicySets.add(policySet);
        }
    }
    return filteredPolicySets;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:36,代码来源:PolicyEvaluationServiceImpl.java

示例9: toSet

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Returns a [Set] containing all unique elements.
 * <p>
 * The returned set preserves the element iteration order of the original collection.
 */
public static <T> Set<T> toSet( @This Iterable<T> thiz )
{
  if( thiz instanceof Collection )
  {
    return ((Collection<T>)thiz).toSet();
  }
  LinkedHashSet<T> set = new LinkedHashSet<>();
  for( T elem : thiz )
  {
    set.add( elem );
  }
  return set;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:19,代码来源:ManIterableExt.java

示例10: getSelectionIds

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public LinkedHashSet<Long> getSelectionIds() {
	LinkedHashSet<Long> result = new LinkedHashSet<Long>();
	for (int i = 0; i < selection.size(); i++) {
		result.add(selection.get(i).getId());
	}
	return result;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:8,代码来源:MultiPickerModelBase.java

示例11: keySet

import java.util.LinkedHashSet; //导入方法依赖的package包/类
@Override
public Set<K> keySet() {
    //todo implement
    //should only return keys where this is active.
    LinkedHashSet<K> set = new LinkedHashSet<K>(innerMap.size());
    Iterator<Map.Entry<K,MapEntry<K,V>>> i = innerMap.entrySet().iterator();
    while ( i.hasNext() ) {
        Map.Entry<K,MapEntry<K,V>> e = i.next();
        K key = e.getKey();
        MapEntry<K,V> entry = innerMap.get(key);
        if ( entry!=null && entry.isActive() ) set.add(key);
    }
    return Collections.unmodifiableSet(set);

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:16,代码来源:AbstractReplicatedMap.java

示例12: store

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Stores the listed object under the specified hash key in map. Unlike a
 * standard map, the listed object will not replace any object already at
 * the appropriate Map location, but rather will be appended to a List
 * stored in that location.
 */
private <H, L> void store(H hashed, L listed, Map<H, LinkedHashSet<L>> map) {
    LinkedHashSet<L> list = map.get(hashed);
    if (list == null) {
        list = new LinkedHashSet<>(1);
        map.put(hashed, list);
    }
    if (!list.contains(listed)) {
        list.add(listed);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:SystemFlavorMap.java

示例13: main

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public static void main(String[] args) {
    
    LinkedHashSet<String> lhs = new LinkedHashSet<>();
    
    lhs.add("C");
    lhs.add("A");
    lhs.add("D");
    lhs.add("B");
    lhs.add("A");
    lhs.add("C");
    System.out.println("Add some element. Content: " + lhs.toString());                                
}
 
开发者ID:mkdika,项目名称:learnjava8,代码行数:13,代码来源:TestLinkedHashSet.java

示例14: handleHtmlMimeTypes

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
                                                         String mimeType) {

    LinkedHashSet<String> returnValues = new LinkedHashSet<>();

    if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
        for (String documentType : htmlDocumntTypes) {
            returnValues.add(mimeType + ";document=" + documentType);
        }
    } else {
        returnValues.add(mimeType);
    }

    return returnValues;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:SystemFlavorMap.java

示例15: handleHtmlMimeTypes

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
                                                         String mimeType) {

    LinkedHashSet<String> returnValues = new LinkedHashSet<>();

    if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
        for (String documentType : htmlDocumentTypes) {
            returnValues.add(mimeType + ";document=" + documentType);
        }
    } else {
        returnValues.add(mimeType);
    }

    return returnValues;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:SystemFlavorMap.java


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