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

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

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

TreeMap.isEmpty介绍

暂无

代码示例

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

/**
 * Determines whether this node has any outgoing transitions.
 
 * @return      true if this node has at least one outgoing _transition, false otherwise
 */
public boolean hasTransitions()
{
  return !outgoingTransitionTreeMap.isEmpty();
}

代码示例来源:origin: google/error-prone

public boolean isEmpty() {
  return replacements.isEmpty();
 }
}

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

/**
 * Return <code>true</code> if this map contains no mappings.
 * 
 * @return is the map currently empty
 */
public boolean isEmpty() {
  if (fast) {
    return (map.isEmpty());
  } else {
    synchronized (map) {
      return (map.isEmpty());
    }
  }
}

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

public boolean hasTempMessage() {
  try {
    this.lockTreeMap.readLock().lockInterruptibly();
    try {
      return !this.msgTreeMap.isEmpty();
    } finally {
      this.lockTreeMap.readLock().unlock();
    }
  } catch (InterruptedException e) {
  }
  return true;
}

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

public Object getLastState() {
  if (_curr.isEmpty()) {
    return null;
  } else {
    return _curr.lastEntry().getValue();
  }
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Print the time series sparsely, i.e. it ignores buckets with 0 events.
 *
 * @param stream the print stream
 */
public void sparsePrint(PrintStream stream) {
 if (mSeries.isEmpty()) {
  return;
 }
 long start = mSeries.firstKey();
 stream.printf("Time series starts at %d with width %d.%n", start, mWidthNano);
 for (Map.Entry<Long, Integer> entry : mSeries.entrySet()) {
  stream.printf("%d %d%n", (entry.getKey() - start) / mWidthNano, entry.getValue());
 }
}

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

public long getMaxSpan() {
  try {
    this.lockTreeMap.readLock().lockInterruptibly();
    try {
      if (!this.msgTreeMap.isEmpty()) {
        return this.msgTreeMap.lastKey() - this.msgTreeMap.firstKey();
      }
    } finally {
      this.lockTreeMap.readLock().unlock();
    }
  } catch (InterruptedException e) {
    log.error("getMaxSpan exception", e);
  }
  return 0;
}

代码示例来源:origin: alibaba/jstorm

public Object getLastState() {
  if (_curr.isEmpty())
    return null;
  else
    return _curr.lastEntry().getValue();
}

代码示例来源:origin: alibaba/jstorm

public Object getLastState() {
  if(_curr.isEmpty()) return null;
  else return _curr.lastEntry().getValue();
}

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

public long estimatedMemSize() {
  if (aggBufMap.isEmpty())
    return 0;
  byte[] sampleKey = aggBufMap.firstKey();
  MeasureAggregator<?>[] sampleValue = aggBufMap.get(sampleKey);
  return estimateSizeOfAggrCache(sampleKey, sampleValue, aggBufMap.size());
}

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

void print(StringBuilder sb, int indent) {
  printIndent(sb, indent);
  sb.append(SEPARATOR).append(name);
  if(children != null && !children.isEmpty()) {
    Collection values=children.values();
    for(Iterator it=values.iterator(); it.hasNext();) {
      sb.append('\n');
      ((Node)it.next()).print(sb, indent + INDENT);
    }
  }
}

代码示例来源:origin: igniterealtime/Smack

@Override
public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) {
  TreeMap<Integer, T_PreKey> preKeys = getCache(userDevice).preKeys;
  if (preKeys.isEmpty() && persistent != null) {
    preKeys.putAll(persistent.loadOmemoPreKeys(userDevice));
  }
  return new TreeMap<>(preKeys);
}

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

/**
 * @return removes the smallest entry (key and value) from this collection
 */
public int pollKey() {
  if (map.isEmpty())
    throw new IllegalStateException("Cannot poll collection is empty!");
  long key = map.pollFirstEntry().getKey();
  return bitUtil.getIntLow(key);
}

代码示例来源:origin: igniterealtime/Smack

@Override
public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) {
  TreeMap<Integer, T_SigPreKey> sigPreKeys = getCache(userDevice).signedPreKeys;
  if (sigPreKeys.isEmpty() && persistent != null) {
    sigPreKeys.putAll(persistent.loadOmemoSignedPreKeys(userDevice));
  }
  return new TreeMap<>(sigPreKeys);
}

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

@Override
 public void close() throws IOException {
  // ColumnizedDeleteEventRegistry reads all the delete events into memory during initialization
  // and it closes the delete event readers after it. If an exception gets thrown during
  // initialization, we may have to close any readers that are still left open.
  while (!sortMerger.isEmpty()) {
   Entry<DeleteRecordKey, DeleteReaderValue> entry = sortMerger.pollFirstEntry();
   entry.getValue().close(); // close the reader for this entry
  }
 }
}

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

public AhoCorasickDoubleArrayTrieSegment loadDictionary(String... pathArray)
  {
    trie = new AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute>();
    TreeMap<String, CoreDictionary.Attribute> map = null;
    try
    {
      map = IOUtil.loadDictionary(pathArray);
    }
    catch (IOException e)
    {
      logger.warning("加载词典失败\n" + TextUtility.exceptionToString(e));
      return this;
    }
    if (map != null && !map.isEmpty())
    {
      trie.build(map);
    }

    return this;
  }
}

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

private void tryCreatePendingStreams() {
  while (!pendingStreams.isEmpty() && canCreateStream()) {
    Map.Entry<Integer, PendingStream> entry = pendingStreams.pollFirstEntry();
    PendingStream pendingStream = entry.getValue();
    try {
      pendingStream.sendFrames();
    } catch (Throwable t) {
      pendingStream.close(t);
    }
  }
}

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

public void testNewMap() {
  assertTrue("New map is empty", map.isEmpty());
  assertEquals("New map has size zero", map.size(), 0);
}

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

public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException,
  MQBrokerException, RemotingException, MQClientException {
  ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup);
  TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>();
  for (Connection c : cc.getConnectionSet()) {
    String clientId = c.getClientId();
    if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) {
      continue;
    }
    try {
      ConsumerRunningInfo info =
        defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false);
      infoMap.put(clientId, info);
    } catch (Exception e) {
    }
  }
  if (!infoMap.isEmpty()) {
    this.monitorListener.reportConsumerRunningInfo(infoMap);
  }
}

代码示例来源:origin: google/guava

assertTrue(ArbitraryInstances.get(BitSet.class).isEmpty());
assertTrue(ArbitraryInstances.get(TreeSet.class).isEmpty());
assertTrue(ArbitraryInstances.get(TreeMap.class).isEmpty());
assertFreshInstanceReturned(
  LinkedList.class,

相关文章

微信公众号

最新文章

更多