Commit 7fa7269e authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

collapse lambdas

parent 1b254ac5
......@@ -56,25 +56,21 @@ public class SolutionsResource
public Map<Integer, List<String>> getTeamSolutions(@Auth User user)
{
Optional<Team> team = teamsRepository.getTeamByUser(user);
List<Solution> byTeam = solutionsRepository.getByTeam(team.get());
Map<Task, List<Solution>> collect = byTeam.stream()
return solutionsRepository.getByTeam(team.get()).stream()
.collect(Collectors.groupingBy(new Function<Solution, Task>()
{
@Override
public Task apply(Solution solution)
public Task apply(Solution solution1)
{
return solution.getTask();
return solution1.getTask();
}
}));
Map<Integer, List<String>> collect1 = collect.entrySet().stream()
})).entrySet().stream()
.collect(Collectors.toMap(
taskSolutions -> taskSolutions.getKey().getLevel(),
taskSolutions -> taskSolutions.getValue().stream()
.map(solution -> solution.getFlag().getDescription()).collect(Collectors.toList())
));
return collect1;
}
@GET
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment