java 使用streamresList根据里面的jobPlanStartTime进行升序排序
时间: 2024-05-11 08:14:51 浏览: 10
可以使用以下代码实现:
```
resList.stream().sorted(Comparator.comparing(Job::getJobPlanStartTime)).collect(Collectors.toList());
```
这段代码使用了Java 8中的Stream和Lambda表达式,首先使用sorted()方法和Comparator.comparing()方法根据jobPlanStartTime属性进行升序排序,然后使用collect(Collectors.toList())方法将排序后的结果转化为List类型。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)