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

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

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

TreeSet.clear介绍

[英]Removes all elements from this TreeSet, leaving it empty.
[中]删除此树集中的所有元素,将其保留为空。

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

@Override
public void clear() {
 super.clear();
 remainingCapacity = initialCapacity;
}

代码示例来源:origin: goldmansachs/gs-collections

public void clear()
{
  this.treeSet.clear();
}

代码示例来源:origin: mabe02/lanterna

/**
 * Marks the whole buffer as dirty so every cell is considered in need to repainting. This is used by methods such
 * as clear and bell that will affect all content at once.
 */
private void setWholeBufferDirty() {
  wholeBufferDirty = true;
  dirtyTerminalCells.clear();
}

代码示例来源:origin: eclipse/eclipse-collections

@Override
public void clear()
{
  this.treeSet.clear();
}

代码示例来源:origin: eclipse/eclipse-collections

@Override
public void clear()
{
  this.treeSet.clear();
}

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

@Override
public void clearMissingClasses() {
  missingClassSet.clear();
}

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

@Override
  public void bulkLoadFromOrderedIterator(@Nonnull Iterator<byte[]> orderedIterator) {
    treeSet.clear();
    for (int i = maxSize; --i >= 0 && orderedIterator.hasNext(); ) {
      treeSet.add(orderedIterator.next());
    }
  }
}

代码示例来源:origin: yigit/android-priority-jobqueue

public synchronized void clear() {
    internalSet.clear();
    groupDelays.clear();
    publicClone = null;
  }
}

代码示例来源:origin: yigit/android-priority-jobqueue

@Override
public void clear() {
  jobs.clear();
  idCache.clear();
}

代码示例来源:origin: mabe02/lanterna

public synchronized TreeSet<TerminalPosition> getAndResetDirtyCells() {
  TreeSet<TerminalPosition> copy = new TreeSet<TerminalPosition>(dirtyTerminalCells);
  dirtyTerminalCells.clear();
  return copy;
}

代码示例来源:origin: hankcs/HanLP

@Override
  public void clear()
  {
    sourceNode = new MDAGNode(false);
    simplifiedSourceNode = null;
    equivalenceClassMDAGNodeHashMap.clear();
    mdagDataArray = null;
    charTreeSet.clear();
    transitionCount = 0;
  }
}

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

public void setFieldGroups(Set<FieldGroup> fieldGroups) {
  this.fieldGroups.clear();
  this.fieldGroups.addAll(fieldGroups);
}

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

public void setTabs(Set<Tab> tabs) {
  this.tabs.clear();
  this.tabs.addAll(tabs);
}

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

@Override
public Versioned<Collection<byte[]>> replace(String key, Collection<? extends byte[]> values) {
 Versioned<Collection<byte[]>> removedValues = new Versioned<>(Sets.newHashSet(valueSet), version);
 valueSet.clear();
 valueSet.addAll(values);
 version = getCurrentIndex();
 return removedValues;
}

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

@Override
public Versioned<Collection<byte[]>> removeAll(String key) {
 Set<byte[]> removedValues = Sets.newHashSet(valueSet);
 valueSet.clear();
 return new Versioned<>(removedValues, version = getCurrentIndex());
}

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

public void clearBugInstances() {
  bugSet.clear();
  invalidateHashes();
}

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

private void populateEntryEventList(DistributedMember target,
  ArrayList<ArrayList<DistTxThinEntryState>> entryEventList, TreeSet<String> sortedRegionMap) {
 DistTXCoordinatorInterface distTxItem = target2realDeals.get(target);
 sortedRegionMap.clear();
 distTxItem.gatherAffectedRegionsName(sortedRegionMap, false, true);
 // Get region as per sorted order of region path
 entryEventList.clear();
 for (String rName : sortedRegionMap) {
  ArrayList<DistTxThinEntryState> entryStates = this.txEntryEventMap.get(rName);
  if (entryStates == null) {
   throw new UnsupportedOperationInTransactionException(
     String.format("Expected %s during a distributed transaction but got %s",
       "entryStates for " + rName + " at target " + target, "null"));
  }
  entryEventList.add(entryStates);
 }
}

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

private void closeReaderAndResetTrackers() {
  inflight.clear();
  tracker.offsets.clear();
  retryList.clear();
  reader.close();
  reader = null;
  releaseLockAndLog(lock, spoutId);
  lock = null;
}

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

public void reset() {
  bundles.clear();
  subscriptions.clear();
  events.clear();
}

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

/**
 *
 */
@Test
public void testMerging_MarksShouldBeDropForSuccessfulBackup() throws Exception {
  ByteBuffer buf = createBuffer();
  ThreadLocalRandom rand = ThreadLocalRandom.current();
  int track = io.countOfPageToTrack(PAGE_SIZE);
  long basePageId = io.trackingPageFor(Math.max(rand.nextLong(Integer.MAX_VALUE - track), 0), PAGE_SIZE);
  assert basePageId >= 0;
  PageIO.setPageId(GridUnsafe.bufferAddress(buf), basePageId);
  TreeSet<Long> setIdx = new TreeSet<>();
  for (int i = 0; i < 4; i++)
    generateMarking(buf, track, basePageId, basePageId + rand.nextInt(1, track), setIdx, i, -1);
  setIdx.clear();
  generateMarking(buf, track, basePageId, basePageId + rand.nextInt(1, track), setIdx, 4, -1);
  TreeSet<Long> setIdx2 = new TreeSet<>();
  generateMarking(buf, track, basePageId, basePageId + rand.nextInt(1, track), setIdx2, 5, 3);
  assertEquals(setIdx.size(), io.countOfChangedPage(buf, 4, PAGE_SIZE));
  assertEquals(setIdx2.size(), io.countOfChangedPage(buf, 5, PAGE_SIZE));
  for (long i = basePageId; i < basePageId + track; i++)
    assertEquals("pageId = " + i, setIdx2.contains(i), io.wasChanged(buf, i, 5, 4, PAGE_SIZE));
}

相关文章