Iterable 类型未定义方法 stream()<EmployeeTwo>

问题描述 投票:0回答:0
@GetMapping("/get")
public ResponseEntity<?> getAll(){
    List<Integer> ages = repo.findAll().stream().map(emp -> emp.getAge()).collect(Collectors.toList());
    return new ResponseEntity<>(repo.findAll(),HttpStatus.OK);
}

因为我正在使用 Java 1.8 版本。直到我遇到这个问题

我期待解决这个问题的解决方案

java mysql spring spring-boot
© www.soinside.com 2019 - 2024. All rights reserved.