SortedSet<ExecutionPeriod> executionPeriods = new TreeSet(new Comparator<ExecutionPeriod>() { public int compare(ExecutionPeriod executionPeriod1, ExecutionPeriod executionPeriod2) { return executionPeriod1.getExecutionYear().getYear().compareTo( executionPeriod2.getExecutionYear().getYear()); } });
Set<ExecutionPeriod> executionPeriods = new HashSet<ExecutionPeriod>();
    private List getInfoSiteEvaluationsHistory(final ExecutionPeriod executionPeriodToTest,            CurricularCourse curricularCourse, ISuportePersistente sp) throws ExcepcaoPersistencia {        List infoSiteEvaluationsHistory = new ArrayList();        SortedSet<ExecutionPeriod> executionPeriods = new TreeSet(new Comparator<ExecutionPeriod>() {            public int compare(ExecutionPeriod executionPeriod1, ExecutionPeriod executionPeriod2) {                return executionPeriod1.getExecutionYear().getYear().compareTo(                        executionPeriod2.getExecutionYear().getYear());            }        });        for (Iterator executionCourseIter = curricularCourse.getAssociatedExecutionCourses().iterator(); executionCourseIter                .hasNext();) {            ExecutionCourse executionCourse = (ExecutionCourse) executionCourseIter.next();            ExecutionPeriod executionPeriod = executionCourse.getExecutionPeriod();            // filter the executionPeriods by semester;            // also, information regarding execution years after the course's            // execution year must not be shown            if (executionPeriod.getSemester().equals(executionPeriodToTest.getSemester()))                if (executionPeriod.getExecutionYear().getBeginDate().before(                        executionPeriodToTest.getExecutionYear().getBeginDate()))                    executionPeriods.add(executionPeriod);        }        Iterator iter = executionPeriods.iterator();        while (iter.hasNext()) {            ExecutionPeriod executionPeriod = (ExecutionPeriod) iter.next();            InfoSiteEvaluationStatistics infoSiteEvaluationStatistics = new InfoSiteEvaluationStatistics();            infoSiteEvaluationStatistics.setInfoExecutionPeriod(InfoExecutionPeriodWithInfoExecutionYear                    .newInfoFromDomain(executionPeriod));            List enrolled = getEnrolled(executionPeriod, curricularCourse, sp);            infoSiteEvaluationStatistics.setEnrolled(new Integer(enrolled.size()));            infoSiteEvaluationStatistics.setEvaluated(getEvaluated(enrolled));            infoSiteEvaluationStatistics.setApproved(getApproved(enrolled));            infoSiteEvaluationsHistory.add(infoSiteEvaluationStatistics);        }        return infoSiteEvaluationsHistory;    }