| | |
| | | List<NearestNextVo> objects = new ArrayList<NearestNextVo>(); |
| | | if (!nearestNextVos.isEmpty()) { |
| | | //收藏的数据 |
| | | List<NearestNextVo> collect = nearestNextVos.stream().filter(s -> s.getIsCollect() == 1).collect(Collectors.toList()); |
| | | collect.sort((o1, o2)->o1.getDistance().compareTo(o2.getDistance()) * -1); |
| | | List<NearestNextVo> collect = nearestNextVos.stream().filter(s -> s.getIsCollect() == 1) |
| | | .sorted(Comparator.comparing(NearestNextVo::getDistance)).collect(Collectors.toList()); |
| | | objects.addAll(collect); |
| | | //非收藏的数据 |
| | | List<NearestNextVo> collect1 = nearestNextVos.stream().filter(s -> s.getIsCollect() == 2).collect(Collectors.toList()); |
| | | collect1.sort((o1, o2)->o1.getDistance().compareTo(o2.getDistance()) * -1); |
| | | List<NearestNextVo> collect1 = nearestNextVos.stream().filter(s -> s.getIsCollect() == 2) |
| | | .sorted(Comparator.comparing(NearestNextVo::getDistance)).collect(Collectors.toList()); |
| | | objects.addAll(collect1); |
| | | |
| | | } |
| | | nearestVo.setPoints(nearestNextVos); |
| | | nearestVo.setTotal(nearestNextVos.size()); |
| | | nearestVo.setPoints(objects); |
| | | nearestVo.setTotal(objects.size()); |
| | | return nearestVo; |
| | | |
| | | } |