Source:
<code>public ImmutableList<RateAccrualPeriod> createAccrualPeriods( Schedule accrualSchedule, Schedule paymentSchedule, ReferenceData refData) { FixedRateStubCalculation initialStub = firstNonNull(this.initialStub, FixedRateStubCalculation.NONE); FixedRateStubCalculation finalStub = firstNonNull(this.finalStub, FixedRateStubCalculation.NONE); Optional<SchedulePeriod> scheduleInitialStub = accrualSchedule.getInitialStub(); Optional<SchedulePeriod> scheduleFinalStub = accrualSchedule.getFinalStub(); DoubleArray resolvedRates = rate.resolveValues(accrualSchedule); ImmutableList.Builder<RateAccrualPeriod> accrualPeriods = ImmutableList.builder(); if (getFutureValueNotional().isPresent()) { ArgChecker.isTrue(accrualSchedule.size() == 1, "only one accrual period when future value notional present"); SchedulePeriod period = accrualSchedule.getPeriod(0); double yearFraction = period.yearFraction(dayCount, accrualSchedule); <START> RateComputation rateComputation = FixedOvernightCompoundedAnnualRateComputation.of(resolvedRates.get(0), yearFraction); <END> accrualPeriods.add( RateAccrualPeriod.builder(period).yearFraction(yearFraction).rateComputation(rateComputation).build()); return accrualPeriods.build(); } for (int i = 0; i < accrualSchedule.size(); i++) { SchedulePeriod period = accrualSchedule.getPeriod(i); double yearFraction = period.yearFraction(dayCount, accrualSchedule); RateComputation rateComputation; if (scheduleInitialStub.isPresent() && scheduleInitialStub.get() == period) { rateComputation = initialStub.createRateComputation(resolvedRates.get(i)); } else if (scheduleFinalStub.isPresent() && scheduleFinalStub.get() == period) { rateComputation = finalStub.createRateComputation(resolvedRates.get(i)); } else { rateComputation = FixedRateComputation.of(resolvedRates.get(i)); } accrualPeriods.add(new RateAccrualPeriod(period, yearFraction, rateComputation)); } return accrualPeriods.build(); }</code><technical_language>Line length 120</technical_language>

Target:
public ImmutableList<RateAccrualPeriod> createAccrualPeriods( Schedule accrualSchedule, Schedule paymentSchedule, ReferenceData refData) { FixedRateStubCalculation initialStub = firstNonNull(this.initialStub, FixedRateStubCalculation.NONE); FixedRateStubCalculation finalStub = firstNonNull(this.finalStub, FixedRateStubCalculation.NONE); Optional<SchedulePeriod> scheduleInitialStub = accrualSchedule.getInitialStub(); Optional<SchedulePeriod> scheduleFinalStub = accrualSchedule.getFinalStub(); DoubleArray resolvedRates = rate.resolveValues(accrualSchedule); if (getFutureValueNotional().isPresent()) { if (accrualSchedule.size() != 1) { throw new IllegalArgumentException( "Invalid swap, only one accrual period allowed when future value notional is present"); } SchedulePeriod period = accrualSchedule.getPeriod(0); double yearFraction = period.yearFraction(dayCount, accrualSchedule); double resolvedRate = resolvedRates.get(0); RateComputation rateComputation = FixedOvernightCompoundedAnnualRateComputation.of(resolvedRate, yearFraction); RateAccrualPeriod accrualPeriod = new RateAccrualPeriod(period, yearFraction, rateComputation); return ImmutableList.of(accrualPeriod); } ImmutableList.Builder<RateAccrualPeriod> accrualPeriods = ImmutableList.builder(); for (int i = 0; i < accrualSchedule.size(); i++) { SchedulePeriod period = accrualSchedule.getPeriod(i); double yearFraction = period.yearFraction(dayCount, accrualSchedule); RateComputation rateComputation; if (scheduleInitialStub.isPresent() && scheduleInitialStub.get() == period) { rateComputation = initialStub.createRateComputation(resolvedRates.get(i)); } else if (scheduleFinalStub.isPresent() && scheduleFinalStub.get() == period) { rateComputation = finalStub.createRateComputation(resolvedRates.get(i)); } else { rateComputation = FixedRateComputation.of(resolvedRates.get(i)); } accrualPeriods.add(new RateAccrualPeriod(period, yearFraction, rateComputation)); } return accrualPeriods.build(); }