java.util.concurrent.ConcurrentSkipListMap.entrySet()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(220)

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

ConcurrentSkipListMap.entrySet介绍

[英]Lazily initialized entry set
[中]延迟初始化的条目集

代码示例

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

@Override
public CloseableIterator<Entry> iterator() {
 // TODO Auto-generated method stub
 return new IterImpl(map.entrySet().iterator());
}

代码示例来源:origin: qunarcorp/qmq

private void deleteAllSegments() {
  for (Map.Entry<Long, LogSegment> entry : segments.entrySet()) {
    deleteSegment(entry.getKey(), entry.getValue());
  }
}

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

@Override
public CloseableIterator<CachedDeserializable> keyIterator() {
 return new KeyItr(map.entrySet().iterator());
}

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

@Override
public CloseableIterator<IndexEntry> iterator() {
 return new Itr(map.entrySet().iterator());
}

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

@ExpectWarning(value="DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS", confidence=Confidence.LOW)
public void addAll(ConcurrentSkipListMap<Color, Integer> m) {
  c.addAll(m.entrySet());
}

代码示例来源:origin: lealone/Lealone

public synchronized void merge() {
  for (Entry<Object, Object> entry : buffer.entrySet()) {
    Object key = entry.getKey();
    Object value = entry.getValue();
    map.put((K) key, (V) value);
    // 执行完put后,可能又有相同key的值来了,此时不能删,只有跟原来相同时才删
    buffer.remove(key, value);
  }
}

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

@Override
 public int cleanUpOneFileCache(
   FileCache<ConcurrentSkipListMap<Long, LlapDataBuffer>> fc,
   int leftToCheck, long endTime, Ref<Boolean> isPastEndTime)
   throws InterruptedException {
  // Iterate thru the file cache. This is best-effort.
  Iterator<Map.Entry<Long, LlapDataBuffer>> subIter = fc.getCache().entrySet().iterator();
  while (subIter.hasNext()) {
   long time = -1;
   isPastEndTime.value = isPastEndTime.value || ((time = System.nanoTime()) >= endTime);
   Thread.sleep(((leftToCheck <= 0) || isPastEndTime.value)
     ? 1 : (endTime - time) / (1000000L * leftToCheck));
   if (subIter.next().getValue().isInvalid()) {
    subIter.remove();
   }
   --leftToCheck;
  }
  return leftToCheck;
 }
}

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

Map<?,?> m = (Map<?,?>) o;
try {
  for (Map.Entry<K,V> e : this.entrySet())
    if (! e.getValue().equals(m.get(e.getKey())))
      return false;

代码示例来源:origin: lealone/Lealone

@Override
public StorageMapCursor<K, V> cursor(K from) {
  return new MemoryMapCursor<>(
      from == null ? skipListMap.entrySet().iterator() : skipListMap.tailMap(from).entrySet().iterator());
}

代码示例来源:origin: qunarcorp/qmq

public void deleteSegments(Predicate<LogSegment> predicate, DeleteHook afterDeleted) {
  int count = segments.size();
  if (count <= 1) return;
  for (final Map.Entry<Long, LogSegment> entry : segments.entrySet()) {
    if (count <= 1) return;
    final LogSegment segment = entry.getValue();
    if (predicate.test(segment)) {
      if (deleteSegment(entry.getKey(), segment)) {
        count = count - 1;
        executeHook(afterDeleted, segment);
        LOG.info("remove expired segment success. segment: {}", segment);
      } else {
        LOG.warn("remove expired segment failed. segment: {}", segment);
        return;
      }
    }
  }
}

代码示例来源:origin: lealone/Lealone

Cursor(BufferedMap<K, V> bmap, IterationParameters<K> parameters) {
  if (parameters.from == null)
    bufferIterator = bmap.buffer.entrySet().iterator();
  else
    bufferIterator = bmap.buffer.tailMap(parameters.from).entrySet().iterator();
  mapCursor = bmap.map.cursor(parameters);
  keyType = bmap.map.getKeyType();
}

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

lockedBufs = new ArrayList<>();
for (Map.Entry<Long, LlapDataBuffer> e2 : e.getValue().getCache().entrySet()) {
 int newRc = e2.getValue().tryIncRef();
 if (newRc < 0) {

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

new ArrayList<>(mIdToChildMap.getOrDefault(inodeId, mEmpty).entrySet()).iterator();
Set<String> unflushedDeletes =
  new HashSet<>(mUnflushedDeletes.getOrDefault(inodeId, Collections.EMPTY_SET));

代码示例来源:origin: apache/incubator-druid

segmentsToDrop.entrySet().iterator(),
  segmentsToLoad.entrySet().iterator()
);

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

@Test
public void testReplace() throws Exception {
 for (Map.Entry<Long, Long> e:csm.entrySet()) {
  Long newValue = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.replace(e.getKey(), newValue), m.replace(e.getKey(), newValue));
 }
 assertEquals(null, m.replace(MAX_RAND + 100L, ThreadLocalRandom.current().nextLong()));
}

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

@Test
public void testReplace1() throws Exception {
 for (Map.Entry<Long, Long> e: csm.entrySet()) {
  Long newValue = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.replace(e.getKey(), e.getValue() + 1, newValue),
    m.replace(e.getKey(), e.getValue() + 1, newValue));
  assertEquals(csm.replace(e.getKey(), e.getValue(), newValue),
    m.replace(e.getKey(), e.getValue(), newValue));
  assertEquals(newValue, m.get(e.getKey()));
  assertEquals(csm.get(e.getKey()), m.get(e.getKey()));
 }
 assertEquals(null, m.replace(MAX_RAND + 100L, ThreadLocalRandom.current().nextLong()));
}

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

try {
 invalidMsg.append("; cache ranges (not necessarily consistent) are ");
 for (Map.Entry<Long, LlapDataBuffer> e : subCache.getCache().entrySet()) {
  long start = e.getKey(), end = start + e.getValue().declaredCachedLength;
  invalidMsg.append("[").append(start).append(", ").append(end).append("), ");

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

@Test
public void testRemove() throws Exception {
 for (Map.Entry<Long, Long> e:csm.entrySet()) {
  assertEquals(csm.remove(e.getKey()), m.remove(e.getKey()));
  assertEquals(null, m.remove(e.getKey()));
 }
}

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

for (Map.Entry<Long, ZookeeperClusterNode> e : rtState.top.nodesByInternalId.entrySet()) {
  if (!alives.containsKey(e.getKey())) {
    ZookeeperClusterNode failedNode = e.getValue();

代码示例来源:origin: mulesoft/mule

@SuppressWarnings("unchecked")
private Map.Entry<?, ?> findEntry(Serializable key) {
 for (Object o : store.entrySet()) {
  Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
  StoredObject<T> object = (StoredObject<T>) entry.getValue();
  if (object.getId().equals(key)) {
   return entry;
  }
 }
 return null;
}

相关文章

ConcurrentSkipListMap类方法