本文整理了Java中java.util.TreeMap.pollLastEntry()
方法的一些代码示例,展示了TreeMap.pollLastEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeMap.pollLastEntry()
方法的具体详情如下:
包路径:java.util.TreeMap
类名称:TreeMap
方法名:pollLastEntry
暂无
代码示例来源:origin: apache/kylin
void updateOnBufferChange() {
if (aggBufMap.size() > aggregateBufferSizeLimit) {
aggBufMap.pollLastEntry();
Preconditions.checkState(aggBufMap.size() == aggregateBufferSizeLimit);
}
currentLastKey = aggBufMap.lastKey();
}
代码示例来源:origin: yacy/yacy_grid_mcp
@Override
public synchronized Map.Entry<K,V> pollLastEntry() {
Map.Entry<K,V> entry = super.pollLastEntry();
boolean removed = removeFromKeys(entry.getKey());
assert removed;
return entry;
}
@Override
代码示例来源:origin: org.elasticsearch/elasticsearch
if (keys.size() >= maxSize) {
int slot = keys.pollLastEntry().getKey();
代码示例来源:origin: org.apache.kylin/kylin-core-cube
void updateOnBufferChange() {
if (aggBufMap.size() > aggregateBufferSizeLimit) {
aggBufMap.pollLastEntry();
Preconditions.checkState(aggBufMap.size() == aggregateBufferSizeLimit);
}
currentLastKey = aggBufMap.lastKey();
}
代码示例来源:origin: chocoteam/choco-solver
/**
* return and remove the largest value stored in this
* @return the largest value stored in this
*/
public int pollLastValue() {
Map.Entry<Integer, E> last = rmap.pollLastEntry();
map.remove(last.getValue());
return last.getKey();
}
代码示例来源:origin: fjfd/microscope
public void add(Span span) {
container.put(span.getDuration(), span);
if (container.size() > this.initialCapacity) {
container.pollLastEntry();
}
}
代码示例来源:origin: stackoverflow.com
public static void main (String[] args) throws java.lang.Exception
{
TreeMap<Integer, String> testTreeMap = new TreeMap<>();
//Populate example map with values
testTreeMap.put(1,"Test");
testTreeMap.put(0, "Test0");
testTreeMap.put(6, "Test6");
testTreeMap.put(4, "Test4");
testTreeMap.put(2, "Test2");
testTreeMap.put(3, "Test3");
testTreeMap.put(5, "Test5");
int i = 0;
while (i <= 3) {
System.out.println("Value is: " + testTreeMap.pollLastEntry());
i++;
}
System.out.println(testTreeMap);
}
代码示例来源:origin: stackoverflow.com
TreeMap<Integer, String> map = new TreeMap<Integer, String>();
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of students: ");
int numStudents = input.nextInt();
for (int i = 0; i < numStudents; i++) {
System.out.print("Enter the student's name: ");
String Student = input.next();
System.out.print("Enter the student's score: ");
int Score = input.nextInt();
map.put(Score, Student);
}
Map.Entry<Integer, String> entry1 = map.pollLastEntry();
Map.Entry<Integer, String> entry2 = map.pollLastEntry();
System.out.println("Highest score: " + entry1.getKey());
System.out.println("Highest scorer: " + entry1.getValue());
System.out.println("Second highest score: " + entry2.getKey());
System.out.println("Second highest scorer: " + entry2.getValue());
代码示例来源:origin: salesforce/Argus
private Map<Long, Double> calculateNDeviationForOneMetric(Map<Long, Double> originalDatapoints, Double tolerance, Long pointNum) {
if (pointNum > originalDatapoints.size()) {
pointNum = (long) originalDatapoints.size();
}
// construct list of values
Long count = 0L;
List<Double> values = new ArrayList<>();
TreeMap<Long, Double> sortedDatapoints = new TreeMap<>(originalDatapoints);
Long lastTimestamp = sortedDatapoints.lastKey();
while (count < pointNum) {
Map.Entry<Long, Double> lastEntry = sortedDatapoints.pollLastEntry();
values.add(lastEntry.getValue());
count++;
}
// calculate the deviation against string list
Double dev = calculateDeviation(values, tolerance);
Map<Long, Double> deviationDatapoints = new TreeMap<>();
deviationDatapoints.put(lastTimestamp, dev);
return deviationDatapoints;
}
代码示例来源:origin: com.salesforce.argus/argus-core
private Map<Long, Double> calculateNDeviationForOneMetric(Map<Long, Double> originalDatapoints, Double tolerance, Long pointNum) {
if (pointNum > originalDatapoints.size()) {
pointNum = (long) originalDatapoints.size();
}
// construct list of values
Long count = 0L;
List<Double> values = new ArrayList<>();
TreeMap<Long, Double> sortedDatapoints = new TreeMap<>(originalDatapoints);
Long lastTimestamp = sortedDatapoints.lastKey();
while (count < pointNum) {
Map.Entry<Long, Double> lastEntry = sortedDatapoints.pollLastEntry();
values.add(lastEntry.getValue());
count++;
}
// calculate the deviation against string list
Double dev = calculateDeviation(values, tolerance);
Map<Long, Double> deviationDatapoints = new TreeMap<>();
deviationDatapoints.put(lastTimestamp, dev);
return deviationDatapoints;
}
代码示例来源:origin: com.n3twork.druid/druid-server
@Override
public QueryableDruidServer pick(
TreeMap<Integer, Set<QueryableDruidServer>> prioritizedServers, DataSegment segment
)
{
final Map.Entry<Integer, Set<QueryableDruidServer>> highestPriorityServers = prioritizedServers.pollLastEntry();
if (highestPriorityServers == null) {
return null;
}
final Set<QueryableDruidServer> servers = highestPriorityServers.getValue();
final int size = servers.size();
switch (size) {
case 0:
throw new ISE("[%s] Something hella weird going on here. We should not be here", segment.getIdentifier());
case 1:
return highestPriorityServers.getValue().iterator().next();
default:
return Collections.min(servers, comparator);
}
}
}
代码示例来源:origin: com.n3twork.druid/druid-server
@Override
public QueryableDruidServer pick(TreeMap<Integer, Set<QueryableDruidServer>> prioritizedServers, DataSegment segment)
{
final Map.Entry<Integer, Set<QueryableDruidServer>> highestPriorityServers = prioritizedServers.pollLastEntry();
if (highestPriorityServers == null) {
return null;
}
final Set<QueryableDruidServer> servers = highestPriorityServers.getValue();
final int size = servers.size();
switch (size) {
case 0:
throw new ISE("[%s] Something hella weird going on here. We should not be here", segment.getIdentifier());
case 1:
return highestPriorityServers.getValue().iterator().next();
default:
return Iterators.get(servers.iterator(), random.nextInt(size));
}
}
}
代码示例来源:origin: fenix-framework/fenix-framework
@Override
Map.Entry<Comparable, Serializable> removeBiggestKeyValue() {
TreeMap<Comparable, Serializable> newMap = duplicateMap();
Map.Entry<Comparable, Serializable> lastEntry = newMap.pollLastEntry();
setEntries(newMap);
return lastEntry;
}
代码示例来源:origin: fenix-framework/fenix-framework
@Override
void mergeWithLeftNode(AbstractNode leftNode, Comparable splitKey) {
InnerNode left = (InnerNode) leftNode; // this node does not know how to merge with another kind
TreeMap<Comparable, AbstractNode> newMap = duplicateMap();
TreeMap<Comparable, AbstractNode> newLeftSubNodes = left.duplicateMap();
// change the parent of all the left sub-nodes
InnerNode uncle = newMap.get(BPlusTree.LAST_KEY).getParent();
for (AbstractNode leftSubNode : newLeftSubNodes.values()) {
leftSubNode.setParent(uncle);
}
// remove the entry for left's LAST_KEY
Map.Entry<Comparable, AbstractNode> higherLeftValue = newLeftSubNodes.pollLastEntry();
// add the higher left value associated with the split-key
newMap.put(splitKey, higherLeftValue.getValue());
// merge the remaining left sub-nodes
newMap.putAll(newLeftSubNodes);
setSubNodes(newMap);
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
break;
Map.Entry lastEntry = indexMap.pollLastEntry();
if (lastEntry.getValue().equals(RESOURCE_PATH)) {
String pathValue = path;
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
break;
Map.Entry lastEntry = indexMap.pollLastEntry();
if (lastEntry.getValue().equals(RESOURCE_PATH)) {
String pathValue = path;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
if (keys.size() >= maxSize) {
int slot = keys.pollLastEntry().getKey();
代码示例来源:origin: apache/servicemix-bundles
if (keys.size() >= maxSize) {
int slot = keys.pollLastEntry().getKey();
代码示例来源:origin: axkr/symja_android_library
while (!compositesToTest.isEmpty()) {
Entry<BigInteger, Integer> compositeEntry = compositesToTest.pollLastEntry();
N = compositeEntry.getKey();
int exp = compositeEntry.getValue();
代码示例来源:origin: matsim-org/matsim
case kinematicWaves:
while ( !consumableHoles.isEmpty() && distanceFromFromNode < consumableHoles.lastKey() ) {
Map.Entry<Double, Hole> entry = consumableHoles.pollLastEntry() ;
distanceFromFromNode -= spacingOfOnePCE * entry.getValue().getSizeInEquivalents() ;
内容来源于网络,如有侵权,请联系作者删除!