本文整理匯總了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());
}
}
}