char[] task = new char[]{'a', 'b', 'c', 'c', 'd', 'e'};
Map<Character, Long> map = IntStream.range(0, task.length)
.mapToObj(idx -> task[idx]).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
char[] task = new char[]{'a', 'b', 'c', 'c', 'd', 'e'};
Map<Character, Long> map = IntStream.range(0, task.length)
.mapToObj(idx -> task[idx]).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));