class UsageDataManager {

    static Map<LocalDate, List<LocalDate>> filterDateAndGroup(final List<String> dateList, final LocalDate current, final Freq fileFrequency) {
        return dateList.stream()//
                .map(s -> LocalDate.parse(s)) // convert to date
                .filter(d -> !d.withDayOfMonth(1).equals(current.withDayOfMonth(1))) // except current month files
                .collect(Collectors.groupingBy(d -> {
                    switch (fileFrequency) {
                    case weekly:
                        return d.with(ChronoField.DAY_OF_WEEK, 1);
                    case monthly:
                        return d.withDayOfMonth(1);
                    case yearly:
                        return d.withDayOfYear(1);
                    default:
                    }
                    return d;
                }));
    }

    private  UsageDataManager();

}