这样的运行速度快吗
private List<Map<String, Object>> getRankingList(RankingCachingParameter parameterObject) {
List<Map<String,Object>> nowDay = isMapper.getdata(parameterObject.day)//从数据库中得到数据;
List<Map<String,Object>> yesterdayDay = isMapper.getdata(parameterObject.yesterday)//从数据库中得到数据;
Map<String,Map<String,Object>> yesterdayDayMap=new HashMap<String,Map<String,Object>>(65536);
yesterdayDay.parallelStream().forEach((Map<String,Object> map) ->{
Long numiid=(Long) map.get("numiid");
Integer type=(Integer) map.get("type");
Integer page=(Integer) map.get("page");
String gener=""+numiid+type+page;
yesterdayDayMap.put(gener, map);
});
nowDay.parallelStream().forEach((Map<String,Object> map) ->{
Long numiid=(Long) map.get("numiid");
Integer type=(Integer) map.get("type");
Integer page=(Integer) map.get("page");
Integer nowdayKeyWord=(Integer) map.get("keywordCount");
String gener=""+numiid+type+page;
Integer yesterdayKeyWord = (Integer) yesterdayDayMap.get(gener).get("keywordCount");
double growthIndex = (nowdayKeyWord-yesterdayKeyWord)/nowdayKeyWord;
map.put("growthIndex", growthIndex);
});
if(parameterObject.orderBy.equals("growthIndex")){
nowDay.sort((Map<String,Object> map1,Map<String,Object> map2) ->{
Double growthIndex1 = (Double) map1.get("growthIndex");
Double growthIndex2 = (Double) map2.get("growthIndex");
if (growthIndex2 != null) {
return growthIndex1.compareTo(growthIndex2);
}
return 0;
});
}
return nowDay;
}
阿神2017-04-17 17:48:28
うーん。 。 。 。 。 直接 list.sorted((o1,o2)->o1.keySet().hashCode() - o2.keySet().hashCode()).forEach(...)
どうしてそのような問題が発生するのでしょうか。