本文整理汇总了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()));
}
示例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;
}
示例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.");
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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", "")));
}