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

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

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

ConcurrentSkipListMap.lastEntry介绍

[英]Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty. The returned entry does not support the Entry.setValue method.
[中]返回与此映射中最大键关联的键值映射,如果映射为空,则返回null。返回的条目支持该条目。设置值方法。

代码示例

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

DispatchLogSegment latestSegment() {
  Map.Entry<Long, DelaySegment<Boolean>> entry = segments.lastEntry();
  if (null == entry) {
    return null;
  }
  return ((DispatchLogSegment) segments.lastEntry().getValue());
}

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

public LogSegment latestSegment() {
  final Map.Entry<Long, LogSegment> entry = segments.lastEntry();
  return entry == null ? null : entry.getValue();
}

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

public Snapshot<T> latestSnapshot() {
  final Map.Entry<Long, Snapshot<T>> entry = snapshots.lastEntry();
  return entry == null ? null : entry.getValue();
}

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

@Test
public void testLastEntry() throws Exception {
 assertEquals(csm.lastEntry().getKey(), m.lastEntry().getKey());
 assertEquals(csm.lastEntry().getValue(), m.lastEntry().getValue());
 assertEquals(csm.lastEntry(), m.lastEntry());
}

代码示例来源:origin: cinchapi/concourse

@Override
public com.google.common.collect.Multiset.Entry<T> lastEntry() {
  return backing.lastEntry().getValue();
}

代码示例来源:origin: limeng32/mybatis.flying

private void observerMethodsFissionFission(ConcurrentSkipListMap<Class<?>, Set<Method>> observerMethodMap,
    ConcurrentSkipListMap<Class<?>, Set<Method>> observerMethodMapNew) {
  Set<Method> tempSet = new LinkedHashSet<>();
  Entry<Class<?>, Set<Method>> lastE = observerMethodMapNew.lastEntry();
  int size1 = lastE.getValue().size();
  for (Method methob : lastE.getValue()) {
    if ("select".equals(methob.getName())) {
      Class<?> clazz = methob.getReturnType();
      if (observerMethodMap.containsKey(clazz)) {
        tempSet.addAll(observerMethodMap.get(clazz));
      }
    }
  }
  lastE.getValue().addAll(tempSet);
  int size2 = lastE.getValue().size();
  if (size1 != size2) {
    observerMethodsFissionFission(observerMethodMap, observerMethodMapNew);
  }
}

代码示例来源:origin: cinchapi/concourse

@Override
public java.util.Map.Entry<K, V> lastEntry() {
  long[] stamps = grabAllSegmentWriteLocks();
  try {
    sort();
    return sorted.lastEntry();
  }
  finally {
    releaseSegmentLocks(stamps);
  }
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

private int randomFamilyId(ThreadLocalRandom random) {
 Map.Entry<Integer, AtomicInteger> first = familyIds.firstEntry();
 Map.Entry<Integer, AtomicInteger> last = familyIds.lastEntry();
 if (first == null || last == null) return 0;
 Map.Entry<Integer, AtomicInteger> ceiling = familyIds.ceilingEntry(random.nextInt(first.getKey(), last.getKey() + 1));
 return ceiling == null ? 0 : ceiling.getKey();
}

代码示例来源:origin: org.apache.hbase/hbase-common

@Test
public void testLastEntry() throws Exception {
 assertEquals(csm.lastEntry().getKey(), m.lastEntry().getKey());
 assertEquals(csm.lastEntry().getValue(), m.lastEntry().getValue());
 assertEquals(csm.lastEntry(), m.lastEntry());
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

@Test
public void testLastEntry() throws Exception {
 assertEquals(csm.lastEntry().getKey(), m.lastEntry().getKey());
 assertEquals(csm.lastEntry().getValue(), m.lastEntry().getValue());
 assertEquals(csm.lastEntry(), m.lastEntry());
}

代码示例来源:origin: indeedeng/lsmtree

@Override
  protected Entry<K, V> computeNext() {
    final Map.Entry<K, Object> entry;
    if (!initialized) {
      initialized = true;
      if (start == null) {
        entry = map.lastEntry();
      } else if (startInclusive) {
        entry = map.floorEntry(start);
      } else {
        entry = map.lowerEntry(start);
      }
    } else {
      entry = map.lowerEntry(key);
    }
    if (entry == null) {
      return endOfData();
    }
    key = entry.getKey();
    final Object value = entry.getValue();
    if (value == deleted) return Entry.createDeleted(key);
    return Entry.create(key, (V)value);
  }
};

代码示例来源:origin: addthis/hydra

/**
 * Helper method for {@link #getLastKey()}.
 */
protected K lastKeyFastPath() {
  Page<K, V> maxPage = getCache().lastEntry().getValue();
  readLock(maxPage);
  try {
    if (maxPage.keys() == null) {
      pullPageFromDisk(maxPage, LockMode.READMODE);
    }
    if (!maxPage.inTransientState() && maxPage.getNextFirstKey() == null && maxPage.size() > 0) {
      return maxPage.keys().get(maxPage.size() - 1);
    }
  } finally {
    readUnlock(maxPage);
  }
  return null;
}

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

int x = 0;
Map.Entry firstEntry = this.valueToEntriesMap.firstEntry();
Map.Entry lastEntry = this.valueToEntriesMap.lastEntry();
int x = 0;
Map.Entry firstEntry = this.valueToEntriesMap.firstEntry();
Map.Entry lastEntry = this.valueToEntriesMap.lastEntry();
if (firstEntry != null && lastEntry != null) {
 Number first = (Number) firstEntry.getKey();

相关文章

微信公众号

最新文章

更多

ConcurrentSkipListMap类方法