com.arch.util.YearMonthUtils Maven / Gradle / Ivy
package com.arch.util;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Created by wagner.araujo on 8/19/16.
*/
public final class YearMonthUtils {
private YearMonthUtils() {
}
public static Collection generateFromLocalDate(LocalDate start, LocalDate end) {
YearMonth yearMonthActual = YearMonth.of(start.getYear(), start.getMonth());
YearMonth yearMonthEnd = YearMonth.of(end.getYear(), end.getMonth());
List listYearMonthReturn = new ArrayList<>();
do {
listYearMonthReturn.add(yearMonthActual);
yearMonthActual = yearMonthActual.plusMonths(1);
} while (yearMonthActual.isBefore(yearMonthEnd));
listYearMonthReturn.add(yearMonthEnd);
return listYearMonthReturn;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy