例子

1
2
3
4
5
6
7
8
9
10
11
List<Map<String, String>> list() {
// Iterable<Album> list = albumRepository.findAll();
return StreamSupport.stream(albumRepository.findAll().spliterator(), false)
.map(album -> {
Map<String, String> map = new HashMap<>();
map.put("uuid", album.getUuid());
map.put("name", album.getName());
return map;
})
.collect(Collectors.toList());
}