当前位置: 首页>>代码示例>>Java>>正文


Java TreeMap.lastEntry方法代码示例

本文整理汇总了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());
}
 
开发者ID:byhieg,项目名称:JavaTutorial,代码行数:7,代码来源:TreeMapExample.java

示例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());	
		}
	}
}
 
开发者ID:JorenSix,项目名称:Panako,代码行数:43,代码来源:NCteQEventPointProcessor.java


注:本文中的java.util.TreeMap.lastEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。