【发布时间】:2019-05-14 12:28:54
【问题描述】:
我正在使用 Spring Data Mongo Pageable 和 Sonar 给我以下错误:
Optional<Order> optional = pageable.getSort().stream().findFirst();
if(optional.isPresent()) {
direction = pageable.getSort().stream().findFirst().get().getDirection();
property = pageable.getSort().stream().findFirst().get().getProperty();
}
SortOperation sortOperation = Aggregation.sort(direction, property);
错误:
在访问值之前调用“Optional#isPresent()”。
我尝试了几个选项,但没有任何效果。
【问题讨论】:
标签: mongodb spring-data-mongodb pageable