private void refreshClubPlayers(Club club) { playerNavigator.refreshPlayers(club.getSeniorPlayers()); playerNavigator.refreshPlayers(club.getYouthPlayers()); // there may be players that are youth but trained in senior squad. List<Player> youthPlayersOnSeniorSquad = new ArrayList<>(); for (Player player : club.getSeniorPlayers()) { if (player.getAge() <= 18) { youthPlayersOnSeniorSquad.add(player); } } club.getSeniorPlayers().removeAll(youthPlayersOnSeniorSquad); club.getYouthPlayers().addAll(youthPlayersOnSeniorSquad); Collections.sort(club.getSeniorPlayers(), DugoutUtils.PLAYER_SKILL_COMPARATOR); Collections.sort(club.getYouthPlayers(), DugoutUtils.PLAYER_SKILL_COMPARATOR); }
private Division getDivision(String divisionId, String divisionName) { Division division = divisionNavigator.getDivision(divisionId, divisionName); for (Club club : division.getClubs()) { clubNavigator.updateClubDetails(club); clubNavigator.loadClubPlayers(club); refreshClubPlayers(club); } Collections.sort(division.getClubs(), DugoutUtils.CLUB_FIRST_11_COMPARATOR); return division; }