Collectors#toMap expects two Functions
set.stream().collect(Collectors.toMap(Function.identity(), x -> samePrice));
You can find nearly the same example within the JavaDoc
Map studentToGPA
students.stream().collect(toMap(Functions.identity(),
student -> computeGPA(student)));