本文整理汇总了Java中java.util.Set.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Set.addAll方法的具体用法?Java Set.addAll怎么用?Java Set.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Set
的用法示例。
在下文中一共展示了Set.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitSubprojects
import java.util.Set; //导入方法依赖的package包/类
private static void visitSubprojects(Project p, Set<Project> projects, boolean main, ProgressHandle h, int[] startEnd) {
if ((main || !ProjectConvertors.isConvertorProject(p)) && projects.add(p)) {
if (h != null) {
h.progress(progressMessage(p), Math.min(++startEnd[0], startEnd[1]));
}
ProjectContainerProvider pcp = p.getLookup().lookup(ProjectContainerProvider.class);
if (pcp != null) {
ProjectContainerProvider.Result res = pcp.getContainedProjects();
projects.addAll(res.getProjects());
if (!res.isRecursive()) {
visitSubprojects(p, projects, false, h, startEnd);
}
} else {
//fallback to semi-deprecated subprojectprovider
SubprojectProvider spp = p.getLookup().lookup(SubprojectProvider.class);
if (spp != null) {
for (Project p2 : spp.getSubprojects()) {
visitSubprojects(p2, projects, false, h, startEnd);
}
}
}
}
}
示例2: processTreeKindHint
import java.util.Set; //导入方法依赖的package包/类
private static void processTreeKindHint(Map<HintMetadata, Collection<HintDescription>> hints, MethodWrapper m, HintMetadata metadata) {
TriggerTreeKind kindTrigger = m.getAnnotation(TriggerTreeKind.class);
if (kindTrigger == null) {
return ;
}
TriggerOptions opts = m.getAnnotation(TriggerOptions.class);
Worker w = new WorkerImpl(m.getClazz().getName(), m.getName());
Set<Kind> kinds = EnumSet.noneOf(Kind.class);
kinds.addAll(Arrays.asList(kindTrigger.value()));
addHint(hints, metadata, HintDescriptionFactory.create()
.setTrigger(new Kinds(kinds))
.setTriggerOptions(opts == null ? null : opts.value())
.setWorker(w)
.setMetadata(metadata)
.produce());
}
示例3: moduleLocations
import java.util.Set; //导入方法依赖的package包/类
private Set<ModuleLocation> moduleLocations(final Location baseLocation) {
if (!forLocation.equals(baseLocation)) {
throw new IllegalStateException(String.format(
"Locations computed for: %s, but queried for: %s", //NOI18N
forLocation,
baseLocation));
}
if (moduleLocations == null) {
final Set<ModuleLocation> moduleRoots = new HashSet<>();
final Set<URL> seen = new HashSet<>();
for (ClassPath.Entry e : modulePath.entries()) {
final URL root = e.getURL();
if (!seen.contains(root)) {
final String moduleName = SourceUtils.getModuleName(root);
if (moduleName != null) {
Collection<? extends URL> p = peers.apply(root);
moduleRoots.add(ModuleLocation.create(baseLocation, p, moduleName));
seen.addAll(p);
}
}
}
moduleLocations = moduleRoots;
}
return moduleLocations;
}
示例4: test
import java.util.Set; //导入方法依赖的package包/类
public void test(int numberOfSmallBidders, int numberOfHighfrequencyBidders) {
SRVMWorld world = new SRVMWorld(SRVMWorldGen.getSingleBandWorldSetup(), new JavaUtilRNGSupplier(147258369L));
Set<SRVMBidderSetup> setups = new HashSet<>();
setups.addAll(SRVMWorldGen.getSimpleSmallBidderSetup(numberOfSmallBidders));
setups.addAll(SRVMWorldGen.getSimpleHighFrequencyBidderSetup(numberOfHighfrequencyBidders));
Collection<SRVMBidder> bidders = world.createPopulation(setups, new JavaUtilRNGSupplier(963852741L));
SRVM_MIP mip = new SRVM_MIP(bidders);
SRVMMipResult result = mip.calculateAllocation();
for (SRVMBidder bidder : bidders) {
GenericValue<SRVMBand> genVal = result.getAllocation(bidder);
for (SRVMBand band : bidder.getWorld().getBands()) {
Integer quantity = genVal.getQuantity(band);
logger.info(new StringBuilder("bidder ").append(bidder.getId()).append("\t").append(band.toString()).append("\t").append(quantity));
}
}
logger.info("Total value:" + result.getTotalValue());
}
示例5: keysSpi
import java.util.Set; //导入方法依赖的package包/类
@Override
protected String[] keysSpi() throws BackingStoreException {
Set<String> keys = new HashSet<String>();
checkDelegates();
for(int i = 0; i < delegates.length; i++) {
if (delegates[i] != null) {
try {
keys.addAll(Arrays.asList(delegates[i].keys()));
} catch (Exception e) {
// mark the delegate as invalid
delegates[i] = null;
}
}
}
return keys.toArray(new String[ keys.size() ]);
}
示例6: init
import java.util.Set; //导入方法依赖的package包/类
public static void init()
{
// Register mod entities
int entityId = 1;
EntityRegistry.registerModEntity(new ResourceLocation("btweagles:stevebeej"), EntitySteveBeej.class, "SteveBeej", entityId++, BetterThanWeagles.instance, 64, 3, true, 0xD1A288, 0x00CCCC);
// Set up spawn criteria
Set<Biome> validBiomes = new HashSet<>();
validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.PLAINS));
validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.FOREST));
validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.HILLS));
validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.SWAMP));
validBiomes.removeAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.NETHER));
validBiomes.removeAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.END));
EntityRegistry.addSpawn(EntitySteveBeej.class, 10, 1, 1, EnumCreatureType.MONSTER, validBiomes.toArray(new Biome[validBiomes.size()]));
// Register entity loot tables
LootTableList.register(EntitySteveBeej.LOOT_TABLE);
}
示例7: findPropertiesForPatterns
import java.util.Set; //导入方法依赖的package包/类
private Set<File> findPropertiesForPatterns(final File basedir, final List<String> patterns) throws IOException {
final Set<File> propertiesFiles = new TreeSet<File>();
for (final String pattern : patterns) {
@SuppressWarnings("unchecked")
final List<File> files = FileUtils.getFiles(basedir, pattern, null);
propertiesFiles.addAll(files);
}
return propertiesFiles;
}
示例8: handleDisjunction
import java.util.Set; //导入方法依赖的package包/类
static Result handleDisjunction(List<Query> disjunctions, int minimumShouldMatch, boolean otherClauses) {
boolean verified = minimumShouldMatch <= 1 && otherClauses == false;
Set<Term> terms = new HashSet<>();
for (Query disjunct : disjunctions) {
Result subResult = analyze(disjunct);
if (subResult.verified == false) {
verified = false;
}
terms.addAll(subResult.terms);
}
return new Result(verified, terms);
}
示例9: visit
import java.util.Set; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any. If no cached
* value exists, visits each child, caches the union of the children's
* return values and returns it.
*
* @return let x = lookup(intExpr) | x != null => x, cache(intExpr,
* intExpr.decls.accept(this) + intExpr.intExpr.accept(this))
*/
public Set<T> visit(SumExpression intExpr) {
Set<T> ret = lookup(intExpr);
if (ret != null)
return ret;
ret = newSet();
ret.addAll(intExpr.decls().accept(this));
ret.addAll(intExpr.intExpr().accept(this));
return cache(intExpr, ret);
}
示例10: addToProject
import java.util.Set; //导入方法依赖的package包/类
public static void addToProject(IJavaProject javaProject)
{
try
{
Set<IClasspathEntry> entries = new LinkedHashSet<>();
entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
entries.add(JavaCore.newContainerEntry(JPFClasspathPlugin.CONTAINER_PATH));
javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
}
catch( JavaModelException e )
{
JPFClasspathLog.logError(e);
}
}
示例11: merge
import java.util.Set; //导入方法依赖的package包/类
public Set<Object> merge(Set<?>... items) {
Set<Object> result = new HashSet<Object>();
for (Set<?> item : items) {
if (item != null) {
result.addAll(item);
}
}
return result;
}
示例12: getCombinationGroups
import java.util.Set; //导入方法依赖的package包/类
/**
* Returns all Long values which have been used for combinations in this ParallelPair
* @return a set of all Long values which have been used for combinations in this ParallelPair
*/
public Set<Long> getCombinationGroups() {
Set<Long> result = new TreeSet<>();
result.addAll(this.nodeMatch1.keySet());
result.addAll(this.nodeMatch2.keySet());
return result;
}
示例13: checkPermissions
import java.util.Set; //导入方法依赖的package包/类
private static void checkPermissions(Context context, PackageInfo packageInfo) {
int i;
Set hashSet = new HashSet();
hashSet.addAll(Arrays.asList(new String[]{"android.permission.INTERNET", "android" +
".permission.ACCESS_NETWORK_STATE", context.getPackageName() + ".permission" +
".MIPUSH_RECEIVE", "android.permission.ACCESS_WIFI_STATE", "android.permission" +
".READ_PHONE_STATE", "android.permission.GET_TASKS", "android.permission" +
".VIBRATE"}));
if (packageInfo.permissions != null) {
for (PermissionInfo permissionInfo : packageInfo.permissions) {
if (r4.equals(permissionInfo.name)) {
i = 1;
break;
}
}
}
i = 0;
if (i == 0) {
throw new a(String.format("<permission android:name=\"%1$s\" /> is undefined.", new
Object[]{r4}), null);
}
if (packageInfo.requestedPermissions != null) {
for (CharSequence charSequence : packageInfo.requestedPermissions) {
if (!TextUtils.isEmpty(charSequence) && hashSet.contains(charSequence)) {
hashSet.remove(charSequence);
if (hashSet.isEmpty()) {
break;
}
}
}
}
if (!hashSet.isEmpty()) {
throw new a(String.format("<use-permission android:name=\"%1$s\" /> is missing.", new
Object[]{hashSet.iterator().next()}), null);
}
}
示例14: join
import java.util.Set; //导入方法依赖的package包/类
String join(List<String> list, String... values) {
Set<String> concat = Sets.newHashSet(values);
if (list != null) {
concat.addAll(list);
}
return concat.stream()
.filter(value -> !Strings.isEmpty(value))
.collect(Collectors.joining("~"));
}
示例15: keySet
import java.util.Set; //导入方法依赖的package包/类
@Override
public Set<String> keySet() {
Set<String> keys = new HashSet(vars.keySet());
keys.addAll(adds.keySet());
return keys;
}