Got this exception:
java.lang.IllegalStateException: Duplicate key 50
I looked over every map that is using that code, and there is no such key It took me a while but I found the problem but it is confusing and very problematic to understand don't know why they did it like this
this is my code:
List<Person> listOfPeople = new LinkedList<Person>();
Map<String, Integer> myMap = listOfPeople
.stream()
.collect(Collectors.toMap(
Person::getNameInString,
Person::getAgeInInt
)
);
My map is String to Integer, so were did 50 came from???