You can use computeIfAbsent. What:
If the specified key is not yet associated with the value (or mapped to zero), it tries to calculate its value using the specified display function and enter it into this map if null is not specified.
returns the current (existing or calculated) value associated with the specified key, or null if the calculated value is null
map.computeIfAbsent(i, k -> new ArrayList<DayDetailsBean>()).add(dayDetails);