if (masterDegreeCandidate.getSpecialization() == specialization) {
if (masterDegreeCandidate.getSpecialization() == specialization && masterDegreeCandidate.getCandidateNumber() != null) {
    public Integer generateCandidateNumberForSpecialization(Specialization specialization) {        int maxCandidateNumber = 0;        for (final MasterDegreeCandidate masterDegreeCandidate : this.getMasterDegreeCandidatesSet()) {            if (masterDegreeCandidate.getSpecialization() == specialization) {                maxCandidateNumber = Math.max(maxCandidateNumber, masterDegreeCandidate.getCandidateNumber());            }        }        return Integer.valueOf(++maxCandidateNumber);    }