I have a list of Dates coming as a request:
requestedDateRange = ["2020-09-10","2020-05-06","2020-04-11"]
I want to convert this list into a map with keys as the map and emptyList in the values which will be populated later.
2020-09-10 -> []
2020-05-06 -> []
2020-04-11 -> []
What I did is as follows :
Map<LocalDate, HashSet<String>> myMap = new HashMap<>();
for (LocalDate date : requestedDateRange){
myMap.put(date, new HashSet<>());
}
Used hashSet to have only unique values
How can I do it in a better way or using Java8 features?