本文整理匯總了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;
}
示例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;
}
示例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));
}
示例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);
}
示例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();
}
示例6: removeAll
import java.util.TreeSet; //導入方法依賴的package包/類
public boolean removeAll(Collection<?> c)
{
for(TreeSet<E> target : other)
target.removeAll(c);
return super.removeAll(c);
}
示例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");
}
}
示例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;
}
示例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;
}