Код: Выделить всё
class User {
private Integer id;
private String name;
private String hobby;
// getter settter ...
}
Код: Выделить всё
// all user's hobby is empty/null
List userList = getUserList();
List hobbyList = userList .stream().map(User::getHobby).distinct().collect(Collectors.toList());
if (!CollectionUtils.isEmpty(hobbyList)) {
//
log.info("[group by hobby] hobby list: {}", String.join(",", hobbyList));
}
я не знаю, как обрабатывать потоковую операцию
Ожидаемый результат: NULL , а не строка 'null'
Подробнее здесь: https://stackoverflow.com/questions/788 ... ull-string