I do restTemplate call and receive rawMap. From debug I see that key class and value class are String. Its ok because service that response to my restTemplate sends map in JSON. Now I want to crate Map with this code:
Map<String, Integer> gameIdsMap = new HashMap<>();
rawGameIdsMap.forEach(((key, value) -> gameIdsMap.put(String.valueOf(key), Integer.parseInt(String.valueOf(value)))));
Im curious. Is there more efficient and more clear way to do it?
I cant just receive from restTemplate Map <String,Integer>
.
RestTemplate
Map rawGameIdsMap = Objects.requireNonNull(restTemplate.getForObject(uriFactory.getReverseGameIdsURI(), Map.class));