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


Java Set.removeAll方法代码示例

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


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

示例1: addAtlasProxyClazz

import java.util.Set; //导入方法依赖的package包/类
public static void addAtlasProxyClazz(Document document, Set<String> nonProxyChannels,  Result result) {

        Element root = document.getRootElement();// Get the root node

        List<? extends Node> serviceNodes = root.selectNodes("//@android:process");

        String packageName = root.attribute("package").getStringValue();

        Set<String> processNames = new HashSet<>();
        processNames.add(packageName);

        for (Node node : serviceNodes) {
            if (null != node && StringUtils.isNotEmpty(node.getStringValue())) {
                String value = node.getStringValue();
                processNames.add(value);
            }
        }

        processNames.removeAll(nonProxyChannels);

        List<String> elementNames = Lists.newArrayList("activity", "service", "provider");

        Element applicationElement = root.element("application");

        for (String processName : processNames) {

            boolean isMainPkg = packageName.equals(processName);
            //boolean isMainPkg = true;
            String processClazzName = processName.replace(":", "").replace(".", "_");

            for (String elementName : elementNames) {

                String fullClazzName = "ATLASPROXY_" +  (isMainPkg ? "" : (packageName.replace(".", "_") + "_" )) +  processClazzName + "_" + StringUtils.capitalize(elementName);

                if ("activity".equals(elementName)) {
                    result.proxyActivities.add(fullClazzName);
                } else if ("service".equals(elementName)) {
                    result.proxyServices.add(fullClazzName);
                } else {
                    result.proxyProviders.add(fullClazzName);
                }

                Element newElement = applicationElement.addElement(elementName);
                newElement.addAttribute("android:name", ATLAS_PROXY_PACKAGE + "." + fullClazzName);

                if (!packageName.equals(processName)) {
                    newElement.addAttribute("android:process", processName);
                }

                boolean isProvider = "provider".equals(elementName);
                if (isProvider) {
                    newElement.addAttribute("android:authorities",
                                            ATLAS_PROXY_PACKAGE + "." + fullClazzName);
                }

            }

        }

    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:61,代码来源:AtlasProxy.java

示例2: undo

import java.util.Set; //导入方法依赖的package包/类
@Override
public void undo() throws CannotUndoException {
    super.undo();
    try {
        Set<QualName> deleted = new HashSet<>(this.newTexts.keySet());
        deleted.removeAll(this.oldTexts.keySet());
        doDeleteTexts(getResourceKind(), deleted);
        if (this.oldProps != null) {
            doPutProperties(this.oldProps);
        }
        doPutTexts(getResourceKind(), this.oldTexts);
    } catch (IOException exc) {
        throw new CannotUndoException();
    }
    notifyObservers(this);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:17,代码来源:SystemStore.java

示例3: repositoriesChanged

import java.util.Set; //导入方法依赖的package包/类
private void repositoriesChanged(PropertyChangeEvent evt) {
        List<RepositoryImpl> oldRepositories = (List) (evt.getOldValue() == null ? Collections.emptyList() : evt.getOldValue());
        List<RepositoryImpl> newRepositories = (List) (evt.getNewValue() == null ? Collections.emptyList() : evt.getNewValue());
        Set<RepositoryImpl> removed = new HashSet<RepositoryImpl>(oldRepositories);
        removed.removeAll(newRepositories);

        if (!removed.isEmpty()) {

            // do we want to delete the data permanently???
            // what if it's a team repo or user recreates the repository???
//            synchronized (persistedTasks) {
//                remove from persisting data
//            }
            boolean changed = false;
            for (IssueImpl impl : getScheduledTasks()) {
                if (removed.contains(impl.getRepositoryImpl())) {
                    if (null != scheduledTasks.remove(impl)) {
                        changed = true;
                    }
                }
            }
            if (changed) {
                fireChange();
            }
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:TaskSchedulingManager.java

示例4: format

import java.util.Set; //导入方法依赖的package包/类
/**
 * Returns the text after replacing all keys with values.
 *
 * @throws IllegalArgumentException if any keys are not replaced.
 */
public CharSequence format() {
	if (formatted == null) {
		if (!keysToValues.keySet().containsAll(keys)) {
			Set<String> missingKeys = new HashSet<String>(keys);
			missingKeys.removeAll(keysToValues.keySet());
			throw new IllegalArgumentException("Missing keys: " + missingKeys);
		}

		// Copy the original pattern to preserve all spans, such as bold, italic, etc.
		StringBuilder sb = new StringBuilder(pattern);
		for (Token t = head; t != null; t = t.next) {
			t.expand(sb, keysToValues);
		}

		formatted = sb;
	}
	return formatted;
}
 
开发者ID:PDDStudio,项目名称:phrase-java,代码行数:24,代码来源:Phrase.java

示例5: redo

import java.util.Set; //导入方法依赖的package包/类
@Override
public void redo() throws CannotRedoException {
    super.redo();
    try {
        Set<QualName> deleted = new HashSet<>(this.oldTexts.keySet());
        deleted.removeAll(this.newTexts.keySet());
        doDeleteTexts(getResourceKind(), deleted);
        if (this.newProps != null) {
            doPutProperties(this.newProps);
        }
        doPutTexts(getResourceKind(), this.newTexts);
    } catch (IOException exc) {
        throw new CannotRedoException();
    }
    notifyObservers(this);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:17,代码来源:SystemStore.java

示例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);
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:23,代码来源:ModEntities.java

示例7: testEraName

import java.util.Set; //导入方法依赖的package包/类
/**
 * tests that era names retrieved from Calendar.getDisplayNames map should
 * match with that of Era names retrieved from DateFormatSymbols.getEras()
 * method for all Gregorian Calendar locales .
 */
public static void testEraName() {
    Set<Locale> allLocales = Set.of(Locale.getAvailableLocales());
    Set<Locale> JpThlocales = Set.of(
            new Locale("th", "TH"),
            new Locale("ja", "JP", "JP"), new Locale("th", "TH", "TH")
    );
    Set<Locale> allLocs = new HashSet<>(allLocales);
    // Removing Japense and Thai Locales to check  Gregorian Calendar Locales
    allLocs.removeAll(JpThlocales);
    allLocs.forEach((locale) -> {
        Calendar cal = Calendar.getInstance(locale);
        Map<String, Integer> names = cal.getDisplayNames(Calendar.ERA, Calendar.ALL_STYLES, locale);
        DateFormatSymbols symbols = new DateFormatSymbols(locale);
        String[] eras = symbols.getEras();
        for (String era : eras) {
            if (!names.containsKey(era)) {
                reportMismatch(names.keySet(), eras, locale);
            }
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:Bug8167273.java

示例8: fetchTrueAttachments

import java.util.Set; //导入方法依赖的package包/类
/**
 * @return Only the downloadable attachments, *not* embedded attachments (as in embedded with cid:attachment, such as images in an email). This includes
 * downloadable nested outlook messages as file attachments!
 */
public List<OutlookFileAttachment> fetchTrueAttachments() {
	final Set<OutlookAttachment> allAttachments = new HashSet<>(getOutlookAttachments());
	allAttachments.removeAll(fetchCIDMap().values());
	final ArrayList<OutlookFileAttachment> fileAttachments = new ArrayList<>();
	for (final OutlookAttachment attachment : allAttachments) {
		if (attachment instanceof OutlookFileAttachment) {
			fileAttachments.add((OutlookFileAttachment) attachment);
		} else {
			LOGGER.warn("Skipping nested Outlook message as file attachment, writing Outlook messages back as data is not supported!");
			LOGGER.warn("To access the nested Outlook message as parsed Java object, refer to .getAttachments() instead.");
		}
	}
	return fileAttachments;
}
 
开发者ID:bbottema,项目名称:outlook-message-parser,代码行数:19,代码来源:OutlookMessage.java

示例9: updateFailedBrokerList

import java.util.Set; //导入方法依赖的package包/类
private void updateFailedBrokerList(Set<Integer> aliveBrokers) {
  // We get the complete broker list from metadata. i.e. any broker that still has a partition assigned to it is
  // included in the broker list. If we cannot update metadata in 60 seconds, skip
  Set<Integer> currentFailedBrokers = _loadMonitor.brokersWithPartitions(MAX_METADATA_WAIT_MS);
  currentFailedBrokers.removeAll(aliveBrokers);
  LOG.debug("Alive brokers: {}, failed brokers: {}", aliveBrokers, currentFailedBrokers);
  // Remove broker that is no longer failed.
  _failedBrokers.entrySet().removeIf(entry -> !currentFailedBrokers.contains(entry.getKey()));
  // Add broker that has just failed.
  for (Integer brokerId : currentFailedBrokers) {
    _failedBrokers.putIfAbsent(brokerId, _time.milliseconds());
  }
}
 
开发者ID:linkedin,项目名称:cruise-control,代码行数:14,代码来源:BrokerFailureDetector.java

示例10: assertContainsDescendants

import java.util.Set; //导入方法依赖的package包/类
/**
 * Asserts that this file contains the given set of descendants (and possibly other files).
 */
public TestFile assertContainsDescendants(String... descendants) {
    assertIsDir();
    Set<String> actual = new TreeSet<String>();
    visit(actual, "", this);

    Set<String> expected = new TreeSet<String>(Arrays.asList(descendants));

    Set<String> missing = new TreeSet<String>(expected);
    missing.removeAll(actual);

    assertTrue(String.format("For dir: %s, missing files: %s, expected: %s, actual: %s", this, missing, expected, actual), missing.isEmpty());

    return this;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:TestFile.java

示例11: testUriPatternsAndTheirAllowedHttpMethods

import java.util.Set; //导入方法依赖的package包/类
@Test(dataProvider = "urisAndTheirAllowedHttpMethods")
public void testUriPatternsAndTheirAllowedHttpMethods(final String uri, final Set<HttpMethod> allowedHttpMethods)
        throws Exception {
    Set<HttpMethod> disallowedHttpMethods = new HashSet<>(ALL_HTTP_METHODS);
    disallowedHttpMethods.removeAll(allowedHttpMethods);
    for (HttpMethod disallowedHttpMethod : disallowedHttpMethods) {
        this.mockMvc.perform(MockMvcRequestBuilders.request(disallowedHttpMethod, URI.create(uri)))
                .andExpect(MockMvcResultMatchers.status().isMethodNotAllowed());
    }
}
 
开发者ID:eclipse,项目名称:keti,代码行数:11,代码来源:EvaluationHttpMethodsFilterTest.java

示例12: iterator

import java.util.Set; //导入方法依赖的package包/类
@Override
public Iterator<String> iterator() {
    if (parent == null) {
        return set.iterator();
    }
    return new Iterator<String>() {
        private Iterator<String> itr = set.iterator();
        private boolean usingParent;

        @Override
        public boolean hasNext() {
            if (itr.hasNext()) {
                return true;
            }
            if (!usingParent) {
                Set<String> nextset = new HashSet<>(parent.keySet());
                nextset.removeAll(set);
                itr = nextset.iterator();
                usingParent = true;
            }
            return itr.hasNext();
        }

        @Override
        public String next() {
            if (hasNext()) {
                return itr.next();
            }
            throw new NoSuchElementException();
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:38,代码来源:ParallelListResourceBundle.java

示例13: assertSame

import java.util.Set; //导入方法依赖的package包/类
private void assertSame(Map<String, Setting> one, Map<String, Setting> two) {
    assertNotNull(one);
    assertNotNull(two);
    assertEquals(one.size(), two.size());
    Set<String> keySet = one.keySet();
    keySet.removeAll(two.keySet());
    assertTrue(keySet.isEmpty());
    for (String key : two.keySet()) {
        assertEquals(one.get(key).getValue(), two.get(key).getValue());
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:ProvisioningSettingsTest.java

示例14: revertShortcutsToDefault

import java.util.Set; //导入方法依赖的package包/类
/**
 * Reverts shortcuts. If there is a conflict between the restored shortucts and other
 * actions, the method will do nothing unless 'force' is true, and returns collection of conflicting actions.
 * Return value of null indicates successful change.
 * 
 * @param action action to revert
 * @param force if true, does not check conflicts; used after user confirmation
 * @return {@code null} for success, or collection of conflicting actions 
 */
synchronized Collection<ShortcutAction> revertShortcutsToDefault(ShortcutAction action, boolean force) {
    if (model.isCustomProfile(getCurrentProfile())) {
        return null;
    }
    Map<ShortcutAction, Set<String>> m = model.getKeymapDefaults (getCurrentProfile());
    m = convertFromEmacs(m);
    Set<String> shortcuts = m.get(action);
    if (shortcuts == null) {
        shortcuts = Collections.<String>emptySet(); //this action has no default shortcut
    }
    //lets search for conflicting SCs
    Set<ShortcutAction> conflictingActions = new HashSet<ShortcutAction>();
    for(String sc : shortcuts) {
        ShortcutAction ac = findActionForShortcut(sc);
        if (ac != null && !ac.equals(action)) {
            conflictingActions.add(ac);
        }
    }
    // retain only conflicting actions from the same keymap manager
    Collection<ShortcutAction> filtered = KeymapModel.filterSameScope(conflictingActions, action);
    if (!filtered.isEmpty() && !force) {
        return conflictingActions;
    }
    revertedActions.add(action);
    setShortcuts(action, shortcuts);
    for (ShortcutAction a : filtered) {
        String[] ss = getShortcuts(a);
        Set<String> newSs = new HashSet<String>(Arrays.asList(ss));
        newSs.removeAll(shortcuts);
        setShortcuts(a, newSs);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:MutableShortcutsModel.java

示例15: testInstalledKits

import java.util.Set; //导入方法依赖的package包/类
public void testInstalledKits() throws Exception {
    String distro = System.getProperty(DISTRO_PROPERTY);
    assertNotNull("Distribution not set, please set by setting property:" + DISTRO_PROPERTY, distro);
    Set<String> kitsGolden = getModulesForDistro(distro, new File(getDataDir(), "kits.properties"));
    if(readExpectedParams()){
        kitsGolden.addAll(expectedIncludes);
        kitsGolden.removeAll(expectedExcludes);
        listExpectedParams();
    }
    Set<String> redundantKits = new HashSet<String>();
    UpdateManager um = UpdateManager.getDefault();
    List<UpdateUnit> l = um.getUpdateUnits(UpdateManager.TYPE.KIT_MODULE);
    for (UpdateUnit updateUnit : l) {
        String kitName = updateUnit.getCodeName();
        if (kitsGolden.contains(kitName)) {
            kitsGolden.remove(kitName);
            System.out.println("OK - IDE contains:" + updateUnit.getCodeName());
        } else {
            redundantKits.add(kitName);
            System.out.println("REDUNDANT - IDE contains:" + kitName);
        }
    }
    for (String missing : kitsGolden) {
        System.out.println("MISSING - IDE does not contain:" + missing);
    }
    assertTrue("Some modules are missing:\n" + setToString(kitsGolden), kitsGolden.isEmpty());
    assertTrue("Some modules are redundant:\n" + setToString(redundantKits), redundantKits.isEmpty());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:InstallationCompletenessTest.java


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