List of usage examples for java.util SortedSet last
E last();
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public YearMonthDay getConclusionDateForBolonha() { if (isBolonha()) { if (hasConcluded()) { final SortedSet<CycleCurriculumGroup> concludeCycles = new TreeSet<CycleCurriculumGroup>( CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID); concludeCycles.addAll(getLastStudentCurricularPlan().getInternalCycleCurriculumGrops()); final CycleCurriculumGroup lastConcludedCycle = concludeCycles.last(); return (lastConcludedCycle.isConclusionProcessed() ? lastConcludedCycle.getConclusionDate() : lastConcludedCycle.calculateConclusionDate()); }// ww w. j ava2s . c o m } else { return getConclusionDate(); } return null; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public StudentCurricularPlan getLastStudentDegreeCurricularPlansByDegree(Degree degree) { final SortedSet<StudentCurricularPlan> result = new TreeSet<StudentCurricularPlan>( StudentCurricularPlan.DATE_COMPARATOR); for (DegreeCurricularPlan degreeCurricularPlan : this.getDegreeCurricularPlans()) { if (degreeCurricularPlan.getDegree() == degree) { result.add(this.getStudentCurricularPlan(degreeCurricularPlan)); }/*from w ww. ja v a2 s. c o m*/ } return result.last(); }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public CycleType getCycleType(final ExecutionYear executionYear) { if (!isBolonha() || isEmptyDegree() || getDegreeType().isEmpty()) { return null; }/*from www . ja v a2 s . c o m*/ final SortedSet<CycleType> concludedCycles = new TreeSet<CycleType>(getConcludedCycles(executionYear)); if (concludedCycles.isEmpty()) { return getLastStudentCurricularPlan().getFirstOrderedCycleCurriculumGroup().getCycleType(); } else { CycleType result = null; for (CycleType cycleType : concludedCycles) { final CycleCurriculumGroup group = getLastStudentCurricularPlan().getCycle(cycleType); if (group.hasEnrolment(executionYear)) { result = cycleType; } } if (result != null) { return result; } final CycleType last = concludedCycles.last(); return last.hasNext() && getDegreeType().hasCycleTypes(last.getNext()) ? last.getNext() : last; } }
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.SortedSet.last()'. * * @see java.util.SortedSet#last()/*from www . j a va 2s . c o m*/ */ public void testLastKey_throwsNoSuchElementException() { SortedSet<E> SortedSet = createNavigableSet(); // test with no entries try { SortedSet.last(); fail("expected exception"); } catch (NoSuchElementException e) { // expected outcome } }