Closed mujun0312 closed 4 years ago
Thanks for your suggestion.
I see, we could offer this, because Collector
also offers a version that has a BinaryOperator<U> mergeFunction
, and our own Collectable.toMap()
methods are merely convenience for the Collector
version.
Of course, the workaround is to use the Collector
API from the JDK
As the title, the method toMap() throws an exception by default when the keys are the same, whether to overload method toMap() by a merge function, used to resolve collisions between values associated with the same key. The version i used is 0.9.12.