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


Java HashSet.addAll方法代码示例

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


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

示例1: isRequired_IMULocationWifiAndBluetooth_areRequired

import java.util.HashSet; //导入方法依赖的package包/类
@Test
public void isRequired_IMULocationWifiAndBluetooth_areRequired() throws Exception {
    HashSet<SensorType> sensorTypes = new HashSet<>();
    sensorTypes.addAll(Arrays.asList(SensorType.imuValues()));
    sensorTypes.add(SensorType.LOCATION);
    sensorTypes.addAll(Arrays.asList(SensorType.wifiValues()));
    sensorTypes.addAll(Arrays.asList(SensorType.bluetoothValues()));

    Long count = Observable.fromIterable(sensorTypes)
            .map(new Function<SensorType, Boolean>() {
                @Override
                public Boolean apply(SensorType sensorType) throws Exception {
                    return basicSensorRequirementChecker.isRequired(sensorType);
                }
            }).filter(new Predicate<Boolean>() {
                @Override
                public boolean test(Boolean required) throws Exception {
                    return required;
                }
            }).count()
            .blockingGet();

    assertThat(count.intValue(), equalTo(sensorTypes.size()));
}
 
开发者ID:ubikgs,项目名称:AndroidSensors,代码行数:25,代码来源:BasicSensorRequirementCheckerTest.java

示例2: getPolicyNodesExpectedHelper

import java.util.HashSet; //导入方法依赖的package包/类
private Set<PolicyNodeImpl> getPolicyNodesExpectedHelper(int depth,
    String expectedOID, boolean matchAny) {

    HashSet<PolicyNodeImpl> set = new HashSet<>();

    if (mDepth < depth) {
        for (PolicyNodeImpl node : mChildren) {
            set.addAll(node.getPolicyNodesExpectedHelper(depth,
                                                         expectedOID,
                                                         matchAny));
        }
    } else {
        if (matchAny) {
            if (mExpectedPolicySet.contains(ANY_POLICY))
                set.add(this);
        } else {
            if (mExpectedPolicySet.contains(expectedOID))
                set.add(this);
        }
    }

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

示例3: FindAppearedFacet

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * 用于找到所有的主题所包含的所有分面列表。
 * 注意,其中,每个主题固有的那4个分面已经被去除。
 */
public static void FindAppearedFacet(List<String> fileName) {
    HashSet<String> set = new HashSet<>();
    String filePath = oriPath + "4_topicNameFilter\\";
    for (String name : fileName) {
        Topic topic = TxtToObject.SaveTxtToObj(filePath + name + ".txt");
        set.addAll(FindFacetOfOneTopic(topic));
    }
    set.remove("definition");
    set.remove("property");
    set.remove("example");
    set.remove("application");
    String facetName = "";
    System.out.println(set.size());
    for (String string : set) {
        facetName = facetName + string + "\n";
    }
    System.out.println(facetName);
    try {
        FileUtils.write(new File(oriPath + "experiment\\facet_order.txt"), facetName, "utf-8");
    } catch (IOException e) {
        e.printStackTrace();
    }
    System.out.println("done.");
}
 
开发者ID:guozhaotong,项目名称:FacetExtract,代码行数:29,代码来源:AAppearedFacet.java

示例4: getValidPackages

import java.util.HashSet; //导入方法依赖的package包/类
protected static HashSet<String> getValidPackages(Context context) {
    // Initialize list of valid packages. This contain all the packages which are already on
    // the device and packages which are being installed. Any item which doesn't belong to
    // this set is removed.
    // Since the loader removes such items anyway, removing these items here doesn't cause
    // any extra data loss and gives us more free space on the grid for better migration.
    HashSet validPackages = new HashSet<>();
    int uninstalled = android.os.Build.VERSION.SDK_INT >= 24 ? PackageManager.MATCH_UNINSTALLED_PACKAGES : PackageManager.GET_UNINSTALLED_PACKAGES;

    for (PackageInfo info : context.getPackageManager()
            .getInstalledPackages(uninstalled)) {
        validPackages.add(info.packageName);
    }
    validPackages.addAll(PackageInstallerCompat.getInstance(context)
            .updateAndGetActiveSessionCache().keySet());
    return validPackages;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:GridSizeMigrationTask.java

示例5: collapseMBB

import java.util.HashSet; //导入方法依赖的package包/类
private void collapseMBB(MachineBasicBlock mbb)
{
    if (mbb.getNumSuccessors() > 1) return;
    MachineBasicBlock succ = mbb.suxAt(0);
    mbb.removeSuccessor(succ);

    // Avoiding cocurrentModificationException
    HashSet<MachineBasicBlock> handled = new HashSet<>();
    handled.addAll(mbb.getPredecessors());
    for (MachineBasicBlock pred : handled)
    {
        pred.removeSuccessor(mbb);
        pred.addSuccessor(succ);
    }

    MachineFunction mf = mbb.getParent();
    // Replace all mbb operand reference to mbb with succ.
    for (MachineBasicBlock mb : mf.getBasicBlocks())
    {
        for (MachineInstr mi : mb.getInsts())
        {
            for (int i = 0, e = mi.getNumOperands(); i < e; i++)
            {
                MachineOperand mo = mi.getOperand(i);
                if (mo.isMBB() && mo.getMBB() == mbb)
                    mo.setMBB(succ);
            }
        }
    }
    mbb.eraseFromParent();
    mf.renumberBlocks();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:33,代码来源:RearrangementMBB.java

示例6: shutdown

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * Kill all Players
 */
public static void shutdown() {
    HashSet<Player> players = new HashSet<Player>();
    players.addAll(currentPlayers);
    for (Player player : players) {
        shutdown(player);
    }
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:11,代码来源:PlayerFactory.java

示例7: getClosestLocale

import java.util.HashSet; //导入方法依赖的package包/类
public Locale getClosestLocale(Collection<?> collection)
{
    if (collection.size() == 0)
    {
        return null;
    }
    // Use the available keys as options
    HashSet<Locale> locales = new HashSet<Locale>();
    for(Object o : collection)
    {
        MLText mlText = (MLText)o;
        locales.addAll(mlText.keySet());
    }
    // Try the content locale
    Locale locale = I18NUtil.getContentLocale();
    Locale match = I18NUtil.getNearestLocale(locale, locales);
    if (match == null)
    {
        // Try just the content locale language
        locale = I18NUtil.getContentLocaleLang();
        match = I18NUtil.getNearestLocale(locale, locales);
        if (match == null)
        {
            // No close matches for the locale - go for the default locale
            locale = I18NUtil.getLocale();
            match = I18NUtil.getNearestLocale(locale, locales);
            if (match == null)
            {
                // just get any locale
                match = I18NUtil.getNearestLocale(null, locales);
            }
        }
    }
    return match;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:MLPropertyInterceptor.java

示例8: getFixedAvoidanceMap

import java.util.HashSet; //导入方法依赖的package包/类
AvoidanceMap getFixedAvoidanceMap() {
	AvoidanceMap ret = initAvoid;
	if (ret == null) {
		HashSet<Component> comps = new HashSet<Component>(circuit.getNonWires());
		comps.addAll(circuit.getWires());
		comps.removeAll(selected);
		ret = AvoidanceMap.create(comps, 0, 0);
		initAvoid = ret;
	}
	return ret;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:12,代码来源:MoveGesture.java

示例9: ensureStartedAndUpdateRegisteredTypes

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * Updates the sync invalidation types that the client is registered for based on the preferred
 * sync types.  Starts the client if needed.
 */
public void ensureStartedAndUpdateRegisteredTypes() {
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService == null) return;

    mStarted = true;

    // Ensure GCM has been initialized.
    ensureGcmIsInitialized();

    // Do not apply changes to {@link #mSessionInvalidationsEnabled} yet because the timer task
    // may be scheduled far into the future.
    mEnableSessionInvalidationsTimer.resume();

    HashSet<Integer> typesToRegister = new HashSet<Integer>();
    typesToRegister.addAll(syncService.getPreferredDataTypes());
    if (!mSessionInvalidationsEnabled) {
        typesToRegister.remove(ModelType.SESSIONS);
        typesToRegister.remove(ModelType.FAVICON_TRACKING);
        typesToRegister.remove(ModelType.FAVICON_IMAGES);
    }

    Intent registerIntent = InvalidationIntentProtocol.createRegisterIntent(
            ChromeSigninController.get(mContext).getSignedInUser(),
            typesToRegister);
    registerIntent.setClass(
            mContext, InvalidationClientService.getRegisteredClass());
    mContext.startService(registerIntent);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:InvalidationController.java

示例10: remove_cleanList

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * 移除清理列表中的数据
 */
public static void remove_cleanList(int _index) {
    _cleanList.remove(_index);
    HashSet<String> _cleanSet = new HashSet<>(_cleanList.size());
    _cleanSet.addAll(_cleanList);
    ConfigUtil.putCleanList(_applicationContext, _cleanSet);
}
 
开发者ID:bonepeople,项目名称:SDCardCleaner,代码行数:10,代码来源:Global.java

示例11: getNetworkComponents

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * Gets all networkComponents contained in a GraphNode Set
 *
 * @param graphNodes the graph nodes
 * @return the network components
 */
public HashSet<NetworkComponent> getNetworkComponents(Set<GraphNode> graphNodes) {
	HashSet<NetworkComponent> networkComponents = new HashSet<NetworkComponent>();
	for (GraphNode graphNode : graphNodes) {
		networkComponents.addAll(this.getNetworkComponents(graphNode));
	}
	return networkComponents;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:14,代码来源:NetworkModel.java

示例12: intersection

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * @see org.odmg.DSet#intersection(DSet)
 */
public DSet intersection(DSet otherSet) {
	read();
	HashSet newset = new HashSet( this.set.size() );
	newset.addAll(this.set);
	newset.retainAll(otherSet);
	return new Set(getSession(), newset);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:Set.java

示例13: getResolveInfos

import java.util.HashSet; //导入方法依赖的package包/类
@NonNull
static HashSet<ResolveInfo> getResolveInfos(PackageManager pm) {
    HashSet<ResolveInfo> rinfo = new HashSet<ResolveInfo>();
    rinfo.addAll(pm.queryIntentActivities(new Intent("org.adw.launcher.THEMES"), PackageManager.GET_META_DATA));
    rinfo.addAll(pm.queryIntentActivities(new Intent("com.gau.go.launcherex.theme"), PackageManager.GET_META_DATA));
    rinfo.addAll(pm.queryIntentActivities(new Intent("mobi.bbase.ahome.THEME"), PackageManager.GET_META_DATA));
    rinfo.addAll(pm.queryIntentActivities(new Intent("com.rogro.GDE.THEME.1"), PackageManager.GET_META_DATA));
    rinfo.addAll(pm.queryIntentActivities(new Intent("com.android.dxtop.launcher.THEME"), PackageManager.GET_META_DATA));
    rinfo.addAll(pm.queryIntentActivities(new Intent("com.fede.launcher.THEME_ICONPACK"), PackageManager.GET_META_DATA));
    return rinfo;
}
 
开发者ID:sofakingforever,项目名称:IconPackParser-Android,代码行数:12,代码来源:IntentHelper.java

示例14: size

import java.util.HashSet; //导入方法依赖的package包/类
/**
 * number of branches from node
 *
 * @param node    Nodemapper object
 * @return        number of branches
 */
public static int size(Nodemapper node) {
    HashSet set = new HashSet();
    if (node.shortCut) set.add("<THAT>");
    if (node.key != null) set.add(node.key);
    if (node.map != null) set.addAll(node.map.keySet());
    return set.size();
}
 
开发者ID:Suhas010,项目名称:Artificial-Intelligent-chat-bot-,代码行数:14,代码来源:NodemapperOperator.java

示例15: testLang

import java.util.HashSet; //导入方法依赖的package包/类
public void testLang()
{
    HashSet<Locale> locales = new HashSet<Locale>();
    locales.addAll(MLAnalysisMode.getLocales(MLAnalysisMode.LOCALE_AND_ALL_CONTAINED_LOCALES, new Locale("en", "GB", ""), false));
    assertTrue(locales.size() >= 1);
    assertTrue(locales.contains(new Locale("en", "GB", "")));
    
    locales = new HashSet<Locale>();
    locales.addAll(MLAnalysisMode.getLocales(MLAnalysisMode.ALL_LANGUAGES, new Locale("en", "GB", ""), false));
    assertTrue(locales.size()>= 9);
    assertTrue(locales.contains(new Locale("en", "", "")));
    assertTrue(locales.contains(new Locale("en", "AU", "")));
    assertTrue(locales.contains(new Locale("en", "GB", "")));
    assertTrue(locales.contains(new Locale("en", "US", "")));
    assertTrue(locales.contains(new Locale("en", "ZA", "")));
    assertTrue(locales.contains(new Locale("en", "CA", "")));
    assertTrue(locales.contains(new Locale("en", "IE", "")));
    assertTrue(locales.contains(new Locale("en", "NZ", "")));
    assertTrue(locales.contains(new Locale("en", "IN", ""))); 
    
    locales = new HashSet<Locale>();
    locales.addAll(MLAnalysisMode.getLocales(MLAnalysisMode.ALL_LANGUAGES_AND_ALL, new Locale("en", "GB", ""), false));
    assertTrue(locales.size()>= 10);
    assertTrue(locales.contains(new Locale("", "", "")));
    assertTrue(locales.contains(new Locale("en", "", "")));
    assertTrue(locales.contains(new Locale("en", "AU", "")));
    assertTrue(locales.contains(new Locale("en", "GB", "")));
    assertTrue(locales.contains(new Locale("en", "US", "")));
    assertTrue(locales.contains(new Locale("en", "ZA", "")));
    assertTrue(locales.contains(new Locale("en", "CA", "")));
    assertTrue(locales.contains(new Locale("en", "IE", "")));
    assertTrue(locales.contains(new Locale("en", "NZ", "")));
    assertTrue(locales.contains(new Locale("en", "IN", ""))); 
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:MLAnaysisModeExpansionTest.java


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