https://www.cnblogs.com/longmaodaxia/p/11308333.html
现在我要对这个List做如下处理 按时间顺序排序 在时间排序的基础上再对pv1Power和pv2Power从大到小排序 过滤重复时间且功率为0的无效字段,仅保留一个有效字段,若全部为0也要保留成仅有一条该时间的数据
//先按日期从小到大排序,再按功率从大到小,之后放入集合中过滤重复,返回List
graphResults = graphResults.stream().sorted(Comparator.comparing(GraphResult::getDate)
.thenComparing((o1, o2) -> Integer.compare(o2.getPv1Power(), o1.getPv1Power()))
.thenComparing((o1, o2) -> Integer.compare(o2.getPv2Power(), o1.getPv2Power())))
.collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet(Comparator.comparing(GraphResult::getDate))), ArrayList::new));//过滤重复时间点