java.util.TreeSet.retainAll()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中java.util.TreeSet.retainAll()方法的一些代码示例,展示了TreeSet.retainAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeSet.retainAll()方法的具体详情如下:
包路径:java.util.TreeSet
类名称:TreeSet
方法名:retainAll

TreeSet.retainAll介绍

暂无

代码示例

代码示例来源:origin: apache/geode

@Override
public boolean retainAll(Collection c) {
 if (c instanceof StructSet) {
  return retainAll((StructSet) c);
 }
 return super.retainAll(c);
}

代码示例来源:origin: spotbugs/spotbugs

notInitializedInConstructors.retainAll(data.readFields);
notInitializedInConstructors.retainAll(data.writtenNonNullFields);
notInitializedInConstructors.retainAll(data.assumedNonNull.keySet());
notInitializedInConstructors.removeAll(data.writtenInConstructorFields);
notInitializedInConstructors.removeAll(data.writtenInInitializationFields);
readOnlyFields.removeAll(data.writtenFields);
readOnlyFields.retainAll(data.readFields);
nullOnlyFields.retainAll(data.readFields);

代码示例来源:origin: geotools/geotools

/**
 * Given a list of type Layer, return all EPSG codes that is supported by all of the layers.
 * This is an intersection of each layer's SRS set.
 *
 * @param layers A List of type Layer
 * @return a Set of type String, containin EPSG codes, or empty if none found
 */
public static Set findCommonEPSGs(List layers) {
  TreeSet set = new TreeSet();
  Layer first = (Layer) layers.get(0);
  set.addAll(first.getSrs());
  for (int i = 1; i < layers.size(); i++) {
    Layer layer = (Layer) layers.get(i);
    set.retainAll(layer.getSrs());
  }
  return set;
}

代码示例来源:origin: pentaho/mondrian

set.retainAll(set2);
return set;

代码示例来源:origin: gradle.plugin.com.s390x/gogradle

@Override
public boolean retainAll(Collection<?> c) {
  return container.retainAll(c);
}

代码示例来源:origin: broadinstitute/picard

private Set<Integer> removeNonExistentCycles(final int[] cycles) {
  final TreeSet<Integer> inputCyclesSet = new TreeSet<Integer>();
  for (final Integer inputCycle : cycles) {
    inputCyclesSet.add(inputCycle);
  }
  inputCyclesSet.retainAll(detectedCycles);
  return inputCyclesSet;
}

代码示例来源:origin: com.github.broadinstitute/picard

private Set<Integer> removeNonExistentCycles(final int[] cycles) {
  final TreeSet<Integer> inputCyclesSet = new TreeSet<Integer>();
  for (final Integer inputCycle : cycles) {
    inputCyclesSet.add(inputCycle);
  }
  inputCyclesSet.retainAll(detectedCycles);
  return inputCyclesSet;
}

代码示例来源:origin: io.snappydata/gemfire-core

@Override
public boolean retainAll(Collection c) {
 if (c instanceof StructSet) { return retainAll((StructSet) c); }
 return super.retainAll(c);
}

代码示例来源:origin: org.apache.geode/gemfire-core

@Override
public boolean retainAll(Collection c) {
 if (c instanceof StructSet) {
  return retainAll((StructSet) c);
 }
 return super.retainAll(c);
}

代码示例来源:origin: org.utgenome.thirdparty/picard

private int[] removeNonExistentCycles(final int[] cycles) {
  final TreeSet<Integer> detectedCyclesSet = new TreeSet<Integer>();
  for(final Integer cycle : detectedCycles) {
    detectedCyclesSet.add(cycle);
  }
  final TreeSet<Integer> inputCyclesSet = new TreeSet<Integer>();
  for(final Integer inputCycle : cycles) {
    inputCyclesSet.add(inputCycle);
  }
  //This also sorts outputCycles
  final int[] outputCycles;
  inputCyclesSet.retainAll(detectedCyclesSet);
  outputCycles = new int[inputCyclesSet.size()];
  int i = 0;
  for(final Integer element : inputCyclesSet) {
    outputCycles[i++] = element;
  }
  return outputCycles;
}

代码示例来源:origin: org.geotools/gt2-wms

/**
 * Given a list of type Layer, return all EPSG codes that is supported
 * by all of the layers. This is an intersection of each layer's SRS set.
 *  
 * @param layers A List of type Layer
 * @return a Set of type String, containin EPSG codes, or empty if none found
 */
public static Set findCommonEPSGs(List layers) {
  TreeSet set = new TreeSet();
  
  Layer first = (Layer) layers.get(0);
  
  set.addAll(first.getSrs());
  
  for (int i = 1; i < layers.size(); i++ ) {
    Layer layer = (Layer) layers.get(i);
    set.retainAll(layer.getSrs());
  }
  
  return set;
}

代码示例来源:origin: org.geotools/gt-wms

/**
 * Given a list of type Layer, return all EPSG codes that is supported by all of the layers.
 * This is an intersection of each layer's SRS set.
 *
 * @param layers A List of type Layer
 * @return a Set of type String, containin EPSG codes, or empty if none found
 */
public static Set findCommonEPSGs(List layers) {
  TreeSet set = new TreeSet();
  Layer first = (Layer) layers.get(0);
  set.addAll(first.getSrs());
  for (int i = 1; i < layers.size(); i++) {
    Layer layer = (Layer) layers.get(i);
    set.retainAll(layer.getSrs());
  }
  return set;
}

代码示例来源:origin: mauricioaniche/ck

@Override
public void setResult(CKNumber result) {
  
  /*
   * LCOM = |P| - |Q| if |P| - |Q| > 0
   * where
   * P = set of all empty set intersections
   * Q = set of all nonempty set intersections
   */
  
  // extracted from https://github.com/dspinellis/ckjm
  int lcom = 0;
  for (int i = 0; i < methods.size(); i++)
    for (int j = i + 1; j < methods.size(); j++) {
      
      TreeSet<?> intersection = (TreeSet<?>)methods.get(i).clone();
      intersection.retainAll(methods.get(j));
      if (intersection.size() == 0) lcom++;
      else lcom--;
    }
  result.setLcom(lcom > 0 ? lcom : 0);
}

代码示例来源:origin: themadcreator/rabinfingerprint

/**
 * Computes (this & that) in GF(2^k)
 */
public Polynomial and(Polynomial that) {
  TreeSet<BigInteger> dgrs = this.createDegreesCollectionCopy();
  dgrs.retainAll(that.degrees);
  return new Polynomial(dgrs);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Retains only the elements in this set that are contained in the
 * specified set.  In other words, removes from this set all of
 * its elements that are not contained in the specified set.  This
 * operation effectively modifies this set so that its value is
 * the <i>intersection</i> of the two sets.
 *
 * @param c set that defines which elements this set will retain.
 * @stable ICU 2.0
 */
public UnicodeSet retainAll(UnicodeSet c) {
  checkFrozen();
  retain(c.list, c.len, 0);
  strings.retainAll(c.strings);
  return this;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: freeplane/freeplane

final AccumulatedIcons iconSet2 = new AccumulatedIcons(Collections.EMPTY_SET);
iconSet2.addAccumulatedIconsToTreeSet(child);
iconSet.childIcons.retainAll(iconSet2.childIcons);
if(iconSet.ownIcons.isEmpty() && iconSet.childIcons.isEmpty())
  break;

相关文章