Skip to content

Instantly share code, notes, and snippets.

@nOy39
Created Sep 17, 2018
Embed
What would you like to do?
List<TaskResponse> responseList = new ArrayList<>();
List<Task> mainContentList = taskRepo.findAllByUserAndSubTaskNullOrderByIdAsc(currentUser);
for (Task task: mainContentList) {
responseList.add(new TaskResponse(
task.getId(),
task.getName(),
task.getColor(),
task.getImageUrl(),
task.getCreated(),
task.getExpiredDate(),
task.getIsDone(),
taskRepo.countDistinctBySubTask(task)
));
}
@nOy39

This comment has been minimized.

Copy link
Owner Author

@nOy39 nOy39 commented Sep 17, 2018

List responseList = taskRepo
.findAllByUserAndSubTaskNullOrderByIdAsc(currentUser);
.stream()
.map(task -> new TaskResponse(
task.getId(),
task.getName(),
task.getColor(),
task.getImageUrl(),
task.getCreated(),
task.getExpiredDate(),
task.getIsDone(),
taskRepo.countDistinctBySubTask(task)
)))
.collect(Collectors.toList())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment