private void setIdsToMatchs(Competition competition) { Integer idMatch = this.getLastCorrectMatchId(); for (Match match : competition.getMatchs()) { if (match.getId() == null) { match.setId(idMatch); idMatch++; } } }
private Integer getLastCorrectMatchId() { Integer id = 0; Set<Match> matchs = this.getAllMatchs(); for (Match match : matchs) { if (match.getId() > id) { id = match.getId(); } } id++; return id; }