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


Java Collections.addAll方法代码示例

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


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

示例1: extractNamesFromResults

import java.util.Collections; //导入方法依赖的package包/类
public static List<Map<String, String>> extractNamesFromResults(NodeList results, String[] names) {
	Set<String> exNames = new HashSet<>();
	List<Map<String, String>> values = new ArrayList<>();
	Collections.addAll(exNames, names);
	for (int i = 0; i < results.getLength(); i++) {
		NodeList bindings = ((Element) results.item(i)).getElementsByTagName("binding");
		Map<String, String> value = new HashMap<>();
		for (int j = 0; j < bindings.getLength(); j++) {
			Element binding = (Element) bindings.item(j);
			String var = binding.getAttribute("name");
			if (exNames.contains(var)) {
				String uri = SparqlExecutor.getTagValue("uri", binding);
				if (!(uri == null))
					value.put(var, FreebaseInfo.uri2id(uri));
			}

		}
		if (value.size() == exNames.size())
		values.add(value);
	}
	return values;
	
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:24,代码来源:RelationSearcher.java

示例2: getSQLKeywords

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Get a comma separated list of all a database's SQL keywords that are NOT also SQL92/SQL2003 keywords.
 * 
 * @return the list
 * @throws SQLException
 */
public String getSQLKeywords() throws SQLException {
    if (mysqlKeywords != null) {
        return mysqlKeywords;
    }

    synchronized (DatabaseMetaData.class) {
        // double check, maybe it's already set
        if (mysqlKeywords != null) {
            return mysqlKeywords;
        }

        Set<String> mysqlKeywordSet = new TreeSet<String>();
        StringBuilder mysqlKeywordsBuffer = new StringBuilder();

        Collections.addAll(mysqlKeywordSet, MYSQL_KEYWORDS);
        mysqlKeywordSet.removeAll(Arrays.asList(Util.isJdbc4() ? SQL2003_KEYWORDS : SQL92_KEYWORDS));

        for (String keyword : mysqlKeywordSet) {
            mysqlKeywordsBuffer.append(",").append(keyword);
        }

        mysqlKeywords = mysqlKeywordsBuffer.substring(1);
        return mysqlKeywords;
    }
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:32,代码来源:DatabaseMetaData.java

示例3: writePrefs

import java.util.Collections; //导入方法依赖的package包/类
public void writePrefs(String filename) {
	data.add(Game.VERSION);
	data.add(String.valueOf(Settings.get("sound")));
	data.add(String.valueOf(Settings.get("autosave")));
	data.add(String.valueOf(Settings.get("fps")));
	data.add(MultiplayerMenu.savedIP);
	data.add(MultiplayerMenu.savedUUID);
	data.add(MultiplayerMenu.savedUsername);
	
	List<String> keyPairs = new ArrayList<>();
	Collections.addAll(keyPairs, Game.input.getKeyPrefs());
	
	data.add(String.join(":", keyPairs.toArray(new String[keyPairs.size()])));
	
	writeToFile(location + filename + extension, data);
}
 
开发者ID:chrisj42,项目名称:minicraft-plus-revived,代码行数:17,代码来源:Save.java

示例4: runTest

import java.util.Collections; //导入方法依赖的package包/类
private static OutputAnalyzer runTest(boolean verifySilently) throws Exception {
  ArrayList<String> vmOpts = new ArrayList();

  Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*"));
  Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
                                           "-XX:+VerifyDuringStartup",
                                           "-XX:+VerifyBeforeGC",
                                           "-XX:+VerifyAfterGC",
                                           (verifySilently ? "-Xlog:gc":"-Xlog:gc+verify=debug"),
                                           RunSystemGC.class.getName()});
  ProcessBuilder pb =
    ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
  OutputAnalyzer output = new OutputAnalyzer(pb.start());

  System.out.println("Output:\n" + output.getOutput());
  return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TestVerifySilently.java

示例5: addInformation

import java.util.Collections; //导入方法依赖的package包/类
/**
 * allows items to add custom lines of information to the mouseover description
 */
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack remote, World world, List<String> curInfo, ITooltipFlag moreInfo) {
    super.addInformation(remote, world, curInfo, moreInfo);
    curInfo.add(I18n.format("gui.remote.tooltip.sneakRightClickToEdit"));
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null && tag.hasKey("securityX")) {
        int x = tag.getInteger("securityX");
        int y = tag.getInteger("securityY");
        int z = tag.getInteger("securityZ");
        int dimensionId = tag.getInteger("securityDimension");
        Collections.addAll(curInfo, WordUtils.wrap(I18n.format("gui.remote.tooltip.boundToSecurityStation", dimensionId, x, y, z), 40).split(System.getProperty("line.separator")));
    } else {
        Collections.addAll(curInfo, WordUtils.wrap(I18n.format("gui.remote.tooltip.rightClickToBind"), 40).split(System.getProperty("line.separator")));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:ItemRemote.java

示例6: createFilterSet

import java.util.Collections; //导入方法依赖的package包/类
private Set<Filter> createFilterSet(String subscriptionId,
        String activationTime, String customerId, String customerName,
        String ServiceId) {
    final Filter subscriptionFilter = new Filter(
            TableColumns.SUBSCRIPTION_ID, subscriptionId);
    final Filter actTimeFilter = new Filter(TableColumns.ACTIVATION_TIME,
            activationTime);
    final Filter orgIdFilter = new Filter(TableColumns.CUSTOMER_ID,
            customerId);
    final Filter orgNameFilter = new Filter(TableColumns.CUSTOMER_NAME,
            customerName);
    final Filter productIdFilter = new Filter(TableColumns.SERVICE_ID,
            ServiceId);
    Set<Filter> filterSet = new HashSet<>();
    Collections.addAll(filterSet, subscriptionFilter, actTimeFilter,
            orgIdFilter, orgNameFilter, productIdFilter);
    return filterSet;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:19,代码来源:SubscriptionDaoIT_Paging_Filtering_Broker.java

示例7: listFiles

import java.util.Collections; //导入方法依赖的package包/类
private static Set<File> listFiles(final File folder) {
    Set<File> files = new HashSet<File>();
    if(folder.isDirectory()) {
        final File[] children = folder.listFiles();
        if(null == children) {
            return files;
        }
        Collections.addAll(files, children);
    }
    return files;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:12,代码来源:FSEventWatchService.java

示例8: addToolSpecificArgs

import java.util.Collections; //导入方法依赖的package包/类
protected void addToolSpecificArgs(T spec, List<String> args) {
    Collections.addAll(args, "-x", getLanguage());
    args.add("-c");
    if (spec.isPositionIndependentCode()) {
        if (!spec.getTargetPlatform().getOperatingSystem().isWindows()) {
            args.add("-fPIC");
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:GccCompilerArgsTransformer.java

示例9: addUserHashBlackList

import java.util.Collections; //导入方法依赖的package包/类
public DanmakuContext addUserHashBlackList(String... hashes) {
    if (!(hashes == null || hashes.length == 0)) {
        Collections.addAll(this.mUserHashBlackList, hashes);
        setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, this.mUserHashBlackList);
        this.mGlobalFlagValues.updateFilterFlag();
        notifyConfigureChanged(DanmakuConfigTag.USER_HASH_BLACK_LIST, this.mUserHashBlackList);
    }
    return this;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:DanmakuContext.java

示例10: concurrentSkipListMultisetGenerator

import java.util.Collections; //导入方法依赖的package包/类
private static TestStringMultisetGenerator concurrentSkipListMultisetGenerator() {
  return new TestStringMultisetGenerator() {
    @Override protected Multiset<String> create(String[] elements) {
      Multiset<String> multiset = new ConcurrentHashMultiset<String>(
          new ConcurrentSkipListMap<String, AtomicInteger>());
      Collections.addAll(multiset, elements);
      return multiset;
    }

    @Override
    public List<String> order(List<String> insertionOrder) {
      return Ordering.natural().sortedCopy(insertionOrder);
    }
  };
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:16,代码来源:ConcurrentHashMultisetTest.java

示例11: newHashSet

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Creates a new HashSet and adds the passed arguments to it.
 *
 * @param items The items to add to the set.
 * @param <T> The type of the set to be created.
 * @return A typed set that contains the passed arguments.
 */
@SafeVarargs
static <T> HashSet<T> newHashSet(T... items) {
  HashSet<T> result = new HashSet<>((items != null) ? items.length : 0);
  if (items != null) {
    Collections.addAll(result, items);
  }
  return result;
}
 
开发者ID:Leanplum,项目名称:Leanplum-Android-SDK,代码行数:16,代码来源:CollectionUtil.java

示例12: getOptionsAsSet

import java.util.Collections; //导入方法依赖的package包/类
/**
 * @return All of the option names, as a set.
 */
@Transient
public Set<String> getOptionsAsSet() {
    final Set<String> set = new HashSet<>();
    Collections.addAll(set, getOptions().split(","));
    return set;
}
 
开发者ID:SourceLabOrg,项目名称:kafka-webview,代码行数:10,代码来源:Filter.java

示例13: addIds

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Adds ids to the query.
 */
public IdsQueryBuilder addIds(String... ids) {
    if (ids == null) {
        throw new IllegalArgumentException("[" + NAME + "] ids cannot be null");
    }
    Collections.addAll(this.ids, ids);
    return this;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:IdsQueryBuilder.java

示例14: findMethodByReturnType

import java.util.Collections; //导入方法依赖的package包/类
/**
 * find method by return value
 *
 * @param type type of returned value
 * @return RefMethod
 * @throws RuntimeException if method not found
 */
public RefMethod findMethodByReturnType(Class type) {
    if (type == null) type = void.class;
    List<Method> methods = new ArrayList<>();
    Collections.addAll(methods, clazz.getMethods());
    Collections.addAll(methods, clazz.getDeclaredMethods());
    for (Method m : methods) {
        if (type.equals(m.getReturnType())) {
            return new RefMethod(m);
        }
    }
    throw new RuntimeException("no such method");
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:20,代码来源:ReflectionUtils.java

示例15: validatedDependents

import java.util.Collections; //导入方法依赖的package包/类
private List<String> validatedDependents( String dependent, String... otherDependents ) {
    List<String> dependents = new ArrayList<String>();
    dependents.add( dependent );
    Collections.addAll( dependents, otherDependents );

    for ( String each : dependents ) {
        if ( !parser.isRecognized( each ) )
            throw new UnconfiguredOptionException( each );
    }

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


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