I am trying to create a Map, where keys run value from 1 to N, and values are some constant for each of these kesys-
private Map<Integer, Integer> getInitialDistMap(int N) {
Function<Integer, Integer> constant = x -> Integer.MAX_VALUE;
return IntStream.rangeClosed(1, N).collect(Collectors.toMap(Function.identity(), constant));
}
This construct is giving me error.