IEnrolment enrollment = (IEnrolment) iterator.next();
IEnrollment enrollment = (IEnrollment) iterator.next();
    public List apply(List curricularCoursesToBeEnrolledIn) {        Integer minYearEnrolledIn = null;        Integer actualYearEnrolledIn = null;        int maxYearTemporarilyEnrolledEnrollment = 0;        int actualYearTemporarilyEnrolledEnrollment = 0;        Iterator iterator = temporaryEnrollments.iterator();        while(iterator.hasNext()) {            IEnrolment enrollment = (IEnrolment) iterator.next();            ICurricularCourse curricularCourse = enrollment.getCurricularCourse();                        actualYearTemporarilyEnrolledEnrollment = getCurricularYearOfCurricularCourse(curricularCourse).intValue();                        if (maxYearTemporarilyEnrolledEnrollment < actualYearTemporarilyEnrolledEnrollment)                maxYearTemporarilyEnrolledEnrollment = actualYearTemporarilyEnrolledEnrollment;        }                iterator = curricularCoursesToBeEnrolledIn.iterator();        while(iterator.hasNext()){                        ICurricularCourse curricularCourse = (ICurricularCourse) iterator.next();            actualYearEnrolledIn = getCurricularYearOfCurricularCourse(curricularCourse);                        if(minYearEnrolledIn == null){                minYearEnrolledIn = actualYearEnrolledIn;               }            else {                if(minYearEnrolledIn.intValue() > actualYearEnrolledIn.intValue())                    minYearEnrolledIn = actualYearEnrolledIn;            }        }                if(minYearEnrolledIn.intValue() < maxYearTemporarilyEnrolledEnrollment)            return null;        else            return curricularCoursesToBeEnrolledIn;    }