Refactoring code in com.baeldung.modelmapper package

This commit is contained in:
Sasa M 2020-04-25 21:57:43 +02:00
parent 58dc739c3e
commit 9f0d8cf6ab
1 changed files with 4 additions and 3 deletions

View File

@ -18,14 +18,15 @@ public class UserPropertyMap extends PropertyMap<UserList, UserListDTO> {
Converter<List<User>, List<String>> converter = new AbstractConverter<List<User>, List<String>>() {
List<String> usernames = new ArrayList<>();
protected List<String> usernames;
@Override
protected List<String> convert(List<User> users) {
users.forEach(user -> usernames.add(user.getUserName()));
usernames = new ArrayList<String>();
users.forEach(user -> usernames.add(user.getUsername()));
return usernames;
}
};
@Override