I am dealing with ellipsis (...) in method parameters in java. The situation is as follows: I fill a Map and do calculations with it, as shown in the code below, but there is 1 method (addAllMood) that must be executed with different parameters in this method (either accept nothing or accept Map)
Map<MOOD, Float> map;
    LocalDate currentDay = LocalDate.now();
    LocalDate startDay = currentDay.minusDays(period.getDays());
    try {
            map = this.messageDao.getMoodStatistics(startDay, currentDay);
    } catch (EmptyResultDataAccessException e) {
        map = addAllMood();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    addAllMood(map);
    return map;
}
private Map addAllMood(Map... map) {
    for (MOOD mood : MOOD.values()) {
        if (map.get(mood) == null) {
            map.put(mood, 0);
        }
    }
    return map;
}
enter image description here Overloading is not considered, you need exactly the option with ... and Map. In the course of work, I had a question : Can I generally use a Map with ellipsis in a method parameter? If so, tell me how this can be done, I will be very grateful)
