diff --git a/backend/src/main/java/ch/puzzle/okr/service/business/ObjectiveBusinessService.java b/backend/src/main/java/ch/puzzle/okr/service/business/ObjectiveBusinessService.java index 85944e1332..2fc9c40a54 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/business/ObjectiveBusinessService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/business/ObjectiveBusinessService.java @@ -57,9 +57,8 @@ public List getAlignmentPossibilities(Long quarterId) { List objectivesByQuarter = objectivePersistenceService.findObjectiveByQuarterId(quarterId); List alignmentDtoList = new ArrayList<>(); - Set teamSet = new HashSet<>(); - objectivesByQuarter.forEach(objective -> teamSet.add(objective.getTeam())); - List teamList = new ArrayList<>(teamSet.stream().sorted(Comparator.comparing(Team::getName)).toList()); + List teamList = objectivesByQuarter.stream().map(Objective::getTeam).distinct() + .sorted(Comparator.comparing(Team::getName)).toList(); teamList.forEach(team -> { List filteredObjectiveList = objectivesByQuarter.stream()