- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    8
- 
        b12
                    For this very short test case:
Stream.of(3, 5).collect(toMap(i -> i % 2, Integer::reverse));
The following exception is produced:
Exception in thread "main" java.lang.IllegalStateException: Duplicate key -1073741824
at java.util.stream.Collectors.lambda$throwingMerger$90(Collectors.java:133)
Clearly, the value being printed is not the key, but rather one of two values for which there is a key collision.
The message thrown should either display at least two values for which there is a key collision or ideally the key for which the collision happened.
Stream.of(3, 5).collect(toMap(i -> i % 2, Integer::reverse));
The following exception is produced:
Exception in thread "main" java.lang.IllegalStateException: Duplicate key -1073741824
at java.util.stream.Collectors.lambda$throwingMerger$90(Collectors.java:133)
Clearly, the value being printed is not the key, but rather one of two values for which there is a key collision.
The message thrown should either display at least two values for which there is a key collision or ideally the key for which the collision happened.
- duplicates
- 
                    JDK-8173464 Wrong exception message when collecting a stream to a map -           
- Closed
 
-         
- 
                    JDK-8179323 Collectors.toMap(keyMapper, valueMapper) has incorrect message in exception thrown on a duplicate key -           
- Closed
 
-         
- 
                    JDK-8178142 Misleading exception message from Collectors.toMap() -           
- Closed
 
-         
- relates to
- 
                    JDK-8266237 Unexpected NullPointerException from Stream.collect(Collectors.toMap) -           
- Closed
 
-