Fix #1127 Comparison method violates its general contract (#1129)

This commit is contained in:
Gao Hongtao 2018-04-27 22:07:49 -05:00 committed by 吴晟 Wu Sheng
parent a12bae590d
commit 268ea2f0d0
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ public class ApplicationMetricEsUIDAO extends EsDAO implements IApplicationMetri
applicationThroughputList.add(applicationThroughput);
});
applicationThroughputList.sort((first, second) -> first.getCpm() > second.getCpm() ? -1 : 1);
applicationThroughputList.sort((first, second) -> Integer.compare(second.getCpm(), first.getCpm()));
if (applicationThroughputList.size() <= topN) {
return applicationThroughputList;

View File

@ -84,7 +84,7 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO
appServerInfoList.add(appServerInfo);
});
appServerInfoList.sort((first, second) -> first.getCpm() > second.getCpm() ? -1 : 1);
appServerInfoList.sort((first, second) -> Integer.compare(second.getCpm(), first.getCpm()));
if (appServerInfoList.size() <= topN) {
return appServerInfoList;
} else {