Is there a convenient Java8 stream API way to convert from List<T>
to Map<T, (index)>
like below example:
List<Character> charList = "ABCDE".chars().mapToObj(e->(char)e).collect(Collectors.toList());
Map<Character, Integer> map = new HashMap<>();
for (int i = 0; i < charList.size(); i++) {
map.put(charList.get(i), i);
}
map = {A=0, B=1, C=2, D=3, E=4}