当前位置: 首页>>代码示例>>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;未经允许,请勿转载。