List of usage examples for java.util List listIterator
ListIterator<E> listIterator(int index);
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public RegistrationState getLastRegistrationState(final ExecutionYear executionYear) { List<RegistrationState> sortedRegistrationsStates = new ArrayList<RegistrationState>( getRegistrationStatesSet()); Collections.sort(sortedRegistrationsStates, RegistrationState.DATE_COMPARATOR); for (ListIterator<RegistrationState> iter = sortedRegistrationsStates .listIterator(sortedRegistrationsStates.size()); iter.hasPrevious();) { RegistrationState state = iter.previous(); if (state.getStateDate().isAfter(executionYear.getEndDateYearMonthDay().toDateTimeAtMidnight())) { continue; }/* ww w .j a v a2 s . c o m*/ return state; } return null; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public RegistrationState getStateInDate(DateTime dateTime) { List<RegistrationState> sortedRegistrationStates = new ArrayList<RegistrationState>( getRegistrationStatesSet()); Collections.sort(sortedRegistrationStates, RegistrationState.DATE_COMPARATOR); for (ListIterator<RegistrationState> iterator = sortedRegistrationStates .listIterator(sortedRegistrationStates.size()); iterator.hasPrevious();) { RegistrationState registrationState = iterator.previous(); if (!dateTime.isBefore(registrationState.getStateDate())) { return registrationState; }//w ww .ja va 2 s . c om } return null; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
private void populateRegistrationStates(final ReadableInstant beginDateTime, final ReadableInstant endDateTime, final Collection<RegistrationState> result) { List<RegistrationState> sortedRegistrationsStates = new ArrayList<RegistrationState>( getRegistrationStatesSet()); Collections.sort(sortedRegistrationsStates, RegistrationState.DATE_COMPARATOR); for (ListIterator<RegistrationState> iter = sortedRegistrationsStates .listIterator(sortedRegistrationsStates.size()); iter.hasPrevious();) { RegistrationState state = iter.previous(); if (state.getStateDate().isAfter(endDateTime)) { continue; }/*from ww w. j a va 2s.c o m*/ result.add(state); if (!state.getStateDate().isAfter(beginDateTime)) { break; } } }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public RegistrationState getStateInDate(final LocalDate localDate) { final List<RegistrationState> sortedRegistrationStates = new ArrayList<RegistrationState>( getRegistrationStatesSet()); Collections.sort(sortedRegistrationStates, RegistrationState.DATE_COMPARATOR); for (ListIterator<RegistrationState> iterator = sortedRegistrationStates .listIterator(sortedRegistrationStates.size()); iterator.hasPrevious();) { RegistrationState registrationState = iterator.previous(); if (!localDate.isBefore(registrationState.getStateDate().toLocalDate())) { return registrationState; }/*from w ww. j a v a2s . co m*/ } return null; }
From source file:com.gst.portfolio.loanaccount.domain.Loan.java
private LocalDate determineExpectedMaturityDate() { final int numberOfInstallments = this.repaymentScheduleInstallments.size(); List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments(); LocalDate maturityDate = installments.get(numberOfInstallments - 1).getDueDate(); ListIterator<LoanRepaymentScheduleInstallment> iterator = installments.listIterator(numberOfInstallments); while (iterator.hasPrevious()) { LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment = iterator.previous(); if (!loanRepaymentScheduleInstallment.isRecalculatedInterestComponent()) { maturityDate = loanRepaymentScheduleInstallment.getDueDate(); break; }/*from ww w .j a v a 2 s. co m*/ } return maturityDate; }