[Solved] Array to Map: no suitable method found for Collectors.toMap [closed]
Actually the 1 is the error. The value 1 cannot serve as the valueMapper, whose type should be Function<? super T, ? extends U>. In your example the value mapper should be a function that accepts an element of your Stream (a String) and returns an Integer. The lambda expression s -> 1 will do. … Read more