I am trying to convert the list of strings to Map as below but am getting a compilation error no instance(s) of type variable(s) K, T exist so that UUID conforms to Function<? super T, ? extends K>
, can someone please help me with it?
List.of("john","jack", "jill")
.stream()
.collect(Collectors.toMap(UUID.randomUUID(), name ->name));