this is a integer array I have
[9,3,15,20,7]
I want to create a map like
0->9 1->3
with index as key and array element as value
IntStream.range(0,postorder.length).collect(Collectors.toMap(i -> postorder[i],i->i));
I tried like this but getting compilation error as required type int found object is there any to create map like this using streams in java