當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeSet.removeAll方法代碼示例

本文整理匯總了Java中java.util.TreeSet.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeSet.removeAll方法的具體用法?Java TreeSet.removeAll怎麽用?Java TreeSet.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.TreeSet的用法示例。


在下文中一共展示了TreeSet.removeAll方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateSubnetWeight

import java.util.TreeSet; //導入方法依賴的package包/類
/** 
 * Calculates the weight of a subnetwork by implementing equation (10) from the LamLien83 paper.
 * @param n The tree node to calculate the subnet weight at (subnet consists of all descendents).
 * @return The weight of the subnetwork.
 * */
public int calculateSubnetWeight(Node n) {
	int weight = 0;
	TreeSet<Integer> partiallyCoveredClasses = n.pcs;
	for (int c = 0; c < partiallyCoveredClasses.size(); c++) {
		TreeSet<Integer> stationsVisitedByClass = stationsVisitedByClass(c);
		stationsVisitedByClass.removeAll(n.stations);
		weight += stationsVisitedByClass.size();
	}

	return weight;
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:17,代碼來源:ClassCoverageUtils.java

示例2: getApps

import java.util.TreeSet; //導入方法依賴的package包/類
@Override
@UiThread
public Set<String> getApps() {
	if (!serviceStarted) {
		apps.addAll(getInstalledScreenFilterApps());
	}
	TreeSet<String> buf = new TreeSet<>();
	if (apps.isEmpty()) {
		return buf;
	}
	buf.addAll(apps);
	buf.removeAll(shownApps);
	return buf;
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:15,代碼來源:ScreenFilterMonitorImpl.java

示例3: verifyBundledJarsHaveNotChanged

import java.util.TreeSet; //導入方法依賴的package包/類
@Test
public void verifyBundledJarsHaveNotChanged() throws IOException {
  TreeMap<String, String> sortedJars = getBundledJars();
  Stream<String> lines =
      sortedJars.entrySet().stream().map(entry -> removeVersion(entry.getKey()));
  Set<String> bundledJarNames = new TreeSet<String>(lines.collect(Collectors.toSet()));

  Files.write(Paths.get("bundled_jars.txt"), bundledJarNames);

  TreeSet<String> newJars = new TreeSet<String>(bundledJarNames);
  newJars.removeAll(expectedJars);
  TreeSet<String> missingJars = new TreeSet<String>(expectedJars);
  missingJars.removeAll(bundledJarNames);

  StringBuilder message = new StringBuilder();
  message.append(
      "The bundled jars have changed. Please make sure you update the licence and notice");
  message.append(
      "\nas described in https://cwiki.apache.org/confluence/display/GEODE/License+Guide+for+Contributors");
  message.append("\nWhen fixed, copy geode-assembly/build/test/bundled_jars.txt");
  message.append("\nto src/test/resources/expected_jars.txt");
  message.append("\nRemoved Jars\n--------------\n");
  message.append(String.join("\n", missingJars));
  message.append("\n\nAdded Jars\n--------------\n");
  message.append(String.join("\n", newJars));
  message.append("\n\n");

  assertTrue(message.toString(), expectedJars.equals(bundledJarNames));

}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:31,代碼來源:BundledJarsJUnitTest.java

示例4: mergeLowestPenaltyIntervals

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * Helper function that finds and merges together the lowest penalty pair of intervals
 * @param intervals
 */
private void mergeLowestPenaltyIntervals(final TreeSet<QualInterval> intervals) {
    // setup the iterators
    final Iterator<QualInterval> it1 = intervals.iterator();
    final Iterator<QualInterval> it1p = intervals.iterator();
    it1p.next(); // skip one

    // walk over the pairs of left and right, keeping track of the pair with the lowest merge penalty
    QualInterval minMerge = null;
    if ( logger.isDebugEnabled() ) logger.debug("mergeLowestPenaltyIntervals: " + intervals.size());
    int lastMergeOrder = 0;
    while ( it1p.hasNext() ) {
        final QualInterval left = it1.next();
        final QualInterval right = it1p.next();
        final QualInterval merged = left.merge(right);
        lastMergeOrder = Math.max(Math.max(lastMergeOrder, left.mergeOrder), right.mergeOrder);
        if ( minMerge == null || (merged.getPenalty() < minMerge.getPenalty() ) ) {
            if ( logger.isDebugEnabled() ) logger.debug("  Updating merge " + minMerge);
            minMerge = merged;
        }
    }

    // now actually go ahead and merge the minMerge pair
    if ( logger.isDebugEnabled() ) logger.debug("  => final min merge " + minMerge);
    intervals.removeAll(minMerge.subIntervals);
    intervals.add(minMerge);
    minMerge.mergeOrder = lastMergeOrder + 1;
    if ( logger.isDebugEnabled() ) logger.debug("updated intervals: " + intervals);
}
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:33,代碼來源:QualQuantizer.java

示例5: getIkkeViste

import java.util.TreeSet; //導入方法依賴的package包/類
/** Giver sorteret af ikke-viste sider, som en streng */
public static String getIkkeViste() {
  TreeSet<String> ejBesøgt = new TreeSet<String>(m.values());
  ejBesøgt.removeAll(besøgt);
  return ejBesøgt.toString();
}
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:7,代碼來源:Sidevisning.java

示例6: removeAll

import java.util.TreeSet; //導入方法依賴的package包/類
public boolean removeAll(Collection<?> c)
{
	for(TreeSet<E> target : other)
		target.removeAll(c);
	return super.removeAll(c);
}
 
開發者ID:mniip,項目名稱:bananapeel,代碼行數:7,代碼來源:BiSet.java

示例7: doOperation

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * Utility that could be on SortedSet. Allows faster implementation than
 * what is in Java for doing addAll, removeAll, retainAll, (complementAll).
 * @param a first set
 * @param relation the relation filter, using ANY, CONTAINS, etc.
 * @param b second set
 * @return the new set
 */    
public static <T extends Object & Comparable<? super T>> SortedSet<? extends T> doOperation(SortedSet<T> a, int relation, SortedSet<T> b) {
    // TODO: optimize this as above
    TreeSet<? extends T> temp;
    switch (relation) {
        case ADDALL:
            a.addAll(b); 
            return a;
        case A:
            return a; // no action
        case B:
            a.clear(); 
            a.addAll(b); 
            return a;
        case REMOVEALL: 
            a.removeAll(b);
            return a;
        case RETAINALL: 
            a.retainAll(b);
            return a;
        // the following is the only case not really supported by Java
        // although all could be optimized
        case COMPLEMENTALL:
            temp = new TreeSet<T>(b);
            temp.removeAll(a);
            a.removeAll(b);
            a.addAll(temp);
            return a;
        case B_REMOVEALL:
            temp = new TreeSet<T>(b);
            temp.removeAll(a);
            a.clear();
            a.addAll(temp);
            return a;
        case NONE:
            a.clear();
            return a;
        default: 
            throw new IllegalArgumentException("Relation " + relation + " out of range");
    }
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:49,代碼來源:SortedSetRelation.java

示例8: findAllAvailableExamLocations

import java.util.TreeSet; //導入方法依賴的package包/類
public static TreeSet findAllAvailableExamLocations(ExamPeriod period) {
    TreeSet locations = findAllExamLocations(period.getSession().getUniqueId(),period.getExamType());
    locations.removeAll(findNotAvailableExamLocations(period.getUniqueId()));
    return locations;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:6,代碼來源:Location.java

示例9: differenceT

import java.util.TreeSet; //導入方法依賴的package包/類
public static <T> TreeSet<T> differenceT(TreeSet<T> setA, TreeSet<T> setB) {
  TreeSet<T> tmp = new TreeSet<T>(setA);
  tmp.removeAll(setB);
  return tmp;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:6,代碼來源:SetUtil.java


注:本文中的java.util.TreeSet.removeAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。