@Test
public void testFindLwdr() {
String idxcd = "A,B,C,D,E,F,G";
String[] split = idxcd.split(",");
List<CommIdxNumber> weeklyRising = commIdxNumberWeekDao
.getWeeklyRising(split);
Map<Double, String> mapValue = new TreeMap<Double, String>();
for (CommIdxNumber commIdxNumber : weeklyRising) {
mapValue.put(commIdxNumber.getLwdr(), commIdxNumber.getIdxcd());
}
Map<Double, String> resultMap = sortMapByKey(mapValue);
System.out.println(resultMap);
}
public static Map<Double, String> sortMapByKey(Map<Double, String> map) {
Map<Double , String> resultMap = new HashMap<Double , String>();
String strValue = "";
Double key = null;
if (map == null || map.isEmpty()) {
return null;
}
Map<Double, String> sortMap = new TreeMap<Double, String>(
new Comparator<Double>() {
@Override
public int compare(Double o1, Double o2) {
return o2.compareTo(o1);
}
});
sortMap.putAll(map);
for (Entry<Double, String> entry : sortMap.entrySet()) {
strValue = entry.getValue();
key = entry.getKey();
if (strValue != null) {
break;
}
}
resultMap.put(key, strValue);
return resultMap;
}@Test
public void testFindLwdr() {
String idxcd