import java.time.format.DateTimeFormatter;
import java.time.YearMonth;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

class Main {
	public static void main(String[] args) {
		Map<String, Long> expectedValues = new HashMap<>();
		expectedValues.put("2021-06-01", 10L);
		expectedValues.put("2021-07-01", 20L);
		expectedValues.put("2021-08-01", 30L);
		
		expectedValues = transform(expectedValues);
		
		// Show the map, sorted by date
		expectedValues.entrySet().stream()
		    .sorted(Map.Entry.comparingByKey())
		    .forEach(e -> System.out.println(e.getKey() + ": " + e.getValue()));
	}
	
	private static Map<String, Long> transform(Map<String, Long> expectedValues) {
		DateTimeFormatter format = DateTimeFormatter.ISO_LOCAL_DATE;
		return Stream.iterate(YearMonth.now(), ym -> ym.minusMonths(1))
		    .limit(12)
		    .map(ym -> ym.atDay(1).format(format))
		    .map(str -> Map.entry(str, expectedValues.getOrDefault(str, 0L)))
		    .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
	}
}