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

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

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

TreeMap.clear介绍

[英]Removes all of the mappings from this map. The map will be empty after this call returns.
[中]

代码示例

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

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

代码示例来源:origin: com.h2database/h2

@Override
public void open(String fileName, boolean readOnly, char[] encryptionKey) {
  memory.clear();
}

代码示例来源:origin: looly/hutool

/**
 * 清空权重表
 * 
 * @return this
 */
public WeightRandom<T> clear() {
  if(null != this.weightMap) {
    this.weightMap.clear();
  }
  return this;
}

代码示例来源:origin: looly/hutool

/**
 * 清空权重表
 * 
 * @return this
 */
public WeightRandom<T> clear() {
  if(null != this.weightMap) {
    this.weightMap.clear();
  }
  return this;
}

代码示例来源:origin: com.h2database/h2

@Override
public void close() {
  memory.clear();
}

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

public void reset() {
 this.keepDeletes = false;
 this.partial = false;
 this.map.clear();
 minModifiedProcId = Long.MAX_VALUE;
 maxModifiedProcId = Long.MIN_VALUE;
}

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

void removeAll() {
  if(children != null)
    children.clear();
}

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

public void clear() {
  size = 0;
  map.clear();
}

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

public void clearMaps() {
  userMap.clear();
  groupMap.clear();
  user_groupMap.clear();
  group_userMap.clear();
  propertyMap.clear();
}

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

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

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

public void clearMaps() {
  roleMap.clear();
  role_parentMap.clear();
  group_roleMap.clear();
  user_roleMap.clear();
}

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

/**
 * Remove all mappings from this map.
 */
public void clear() {
  if (fast) {
    synchronized (this) {
      map = new TreeMap();
    }
  } else {
    synchronized (map) {
      map.clear();
    }
  }
}

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

public void clear() {
  try {
    this.lockTreeMap.writeLock().lockInterruptibly();
    try {
      this.msgTreeMap.clear();
      this.consumingMsgOrderlyTreeMap.clear();
      this.msgCount.set(0);
      this.msgSize.set(0);
      this.queueOffsetMax = 0L;
    } finally {
      this.lockTreeMap.writeLock().unlock();
    }
  } catch (InterruptedException e) {
    log.error("rollback exception", e);
  }
}

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

public void rollback() {
  try {
    this.lockTreeMap.writeLock().lockInterruptibly();
    try {
      this.msgTreeMap.putAll(this.consumingMsgOrderlyTreeMap);
      this.consumingMsgOrderlyTreeMap.clear();
    } finally {
      this.lockTreeMap.writeLock().unlock();
    }
  } catch (InterruptedException e) {
    log.error("rollback exception", e);
  }
}

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

@Resetter
public static void reset() {
 stats.clear();
}

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

public static void clearColumnStatsState(Map<String, String> params) {
 if (params == null) {
  return;
 }
 ColumnStatsAccurate stats = parseStatsAcc(params.get(COLUMN_STATS_ACCURATE));
 stats.columnStats.clear();
 try {
  params.put(COLUMN_STATS_ACCURATE, ColumnStatsAccurate.objectWriter.writeValueAsString(stats));
 } catch (JsonProcessingException e) {
  LOG.trace(e.getMessage());
 }
}

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

/**
 * Clear the current state of hbck.
 */
private void clearState() {
 // Make sure regionInfo is empty before starting
 fixes = 0;
 regionInfoMap.clear();
 emptyRegionInfoQualifiers.clear();
 tableStates.clear();
 errors.clear();
 tablesInfo.clear();
 orphanHdfsDirs.clear();
 skippedRegions.clear();
}

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

public void stop() throws Exception {
  if (started.compareAndSet(true, false)) {
    stopDispatching();
    timer.cancel();
    jobs.clear();
    LOG.trace("JobScheduler[{}] stopped", name);
  }
}

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

public long commit() {
  try {
    this.lockTreeMap.writeLock().lockInterruptibly();
    try {
      Long offset = this.consumingMsgOrderlyTreeMap.lastKey();
      msgCount.addAndGet(0 - this.consumingMsgOrderlyTreeMap.size());
      for (MessageExt msg : this.consumingMsgOrderlyTreeMap.values()) {
        msgSize.addAndGet(0 - msg.getBody().length);
      }
      this.consumingMsgOrderlyTreeMap.clear();
      if (offset != null) {
        return offset + 1;
      }
    } finally {
      this.lockTreeMap.writeLock().unlock();
    }
  } catch (InterruptedException e) {
    log.error("commit exception", e);
  }
  return -1;
}

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

public void shutdown() throws InterruptedException {
  mutex.lock();
  try {
    stopped = true;
    tree.clear();
    watchers.clear();
    executor.shutdownNow();
  } finally {
    mutex.unlock();
  }
}

相关文章