I am trying to convert a list into the keys of a Map, and having default values of null.
However, my code requires the creation of a HashMap via the new keyword that goes against the principle of Inversion of Control in Spring.
May I know if there is any right way in Spring to initialize the map in this situation?
convertStringToList(input).stream().collect(HashMap::new,
(map, value) -> map.put(value, null), Map::putAll);