本文整理汇总了Java中java.util.TreeMap.lastEntry方法的典型用法代码示例。如果您正苦于以下问题:Java TreeMap.lastEntry方法的具体用法?Java TreeMap.lastEntry怎么用?Java TreeMap.lastEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.TreeMap
的用法示例。
在下文中一共展示了TreeMap.lastEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLargestEntry
import java.util.TreeMap; //导入方法依赖的package包/类
public void getLargestEntry(TreeMap<String,String> maps){
Map.Entry<String,String> entry = maps.lastEntry();
System.out.println("最大的Entry如下");
System.out.print("key = " + entry.getKey());
System.out.println(" value = " + entry.getValue());
}
示例2: packEventPointsIntoFingerprints
import java.util.TreeMap; //导入方法依赖的package包/类
private void packEventPointsIntoFingerprints(){
int minTimeDifference = 7;//time steps
//Pack the event points into fingerprints
for(int i = 0; i < eventPoints.size();i++){
int t1 = eventPoints.get(i).t;
int f1 = eventPoints.get(i).f;
int maxtFirstLevel = t1 + maxEventPointDeltaTInSteps;
int maxfFirstLevel = f1 + maxEventPointDeltaFInBins;
int minfFirstLevel = f1 - maxEventPointDeltaFInBins;
//A list of fingerprints Per Event Point, ordered by energy of the combined event points
TreeMap<Float,NCteQFingerprint> fingerprintsPerEventPoint = new TreeMap<Float,NCteQFingerprint>();
for(int j = i + 1; j < eventPoints.size() && eventPoints.get(j).t < maxtFirstLevel;j++){
int t2 = eventPoints.get(j).t;
int f2 = eventPoints.get(j).f;
if(t1 != t2 && t2 > t1 + minTimeDifference && f2 > minfFirstLevel && f2 < maxfFirstLevel){
int maxtScndLevel = t2 + maxEventPointDeltaTInSteps;
int maxfScndLevel = f2 + maxEventPointDeltaFInBins;
int minfScndLevel = f2 - maxEventPointDeltaFInBins;
for(int k = j + 1; k < eventPoints.size() && eventPoints.get(k).t < maxtScndLevel ;k++){
int f3 = eventPoints.get(k).f;
int t3 = eventPoints.get(k).t;
if(t2 != t3 && t3 > t2 + minTimeDifference && f3 > minfScndLevel && f3 < maxfScndLevel){
float energy = eventPoints.get(k).contrast + eventPoints.get(j).contrast + eventPoints.get(i).contrast ;
fingerprintsPerEventPoint.put(energy,new NCteQFingerprint(t1, f1, t2, f2, t3, f3));
}
}
}
}
if(fingerprintsPerEventPoint.size() >= maxFingerprintsPerEventPoint ){
for(int s = 0 ; s < maxFingerprintsPerEventPoint ; s++){
Entry<Float, NCteQFingerprint> e = fingerprintsPerEventPoint.lastEntry();
fingerprints.add(e.getValue());
fingerprintsPerEventPoint.remove(e.getKey());
}
}else{
fingerprints.addAll(fingerprintsPerEventPoint.values());
}
}
}