private UserDTO getUser(Long id) { if (user == null || !user.getId().equals(id)) { user = userService.getUserById(id); } return user; }
public void visitUsers(UserVisitor visitor) { for (UserDTO u : userService.getAllUsers()) { visitor.visit(u.getId(), u.getLastName(), u.getFirstName()); } }