I want to convert array into Map using Java 8 streams:
String[] arr = {"two", "times", "two", "is", "four"};
Arrays.stream(arr).collect(Collectors.toMap(s -> s, 1, Integer::sum);
The s -> s
part is marked as error
no instance(s) of type variable(s) T, U exists so that Integer conforms to Function