Skip to content

Instantly share code, notes, and snippets.

@nOy39
Created September 17, 2018 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nOy39/90e1508dbcc6794653480a192db6b944 to your computer and use it in GitHub Desktop.
Save nOy39/90e1508dbcc6794653480a192db6b944 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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