jOOQ / jOOL

jOOλ - The Missing Parts in Java 8 jOOλ improves the JDK libraries in areas where the Expert Group's focus was elsewhere. It adds tuple support, function support, and a lot of additional functionality around sequential Streams. The JDK 8's main efforts (default methods, lambdas, and the Stream API) were focused around maintaining backwards compatibility and implementing a functional API for parallelism.
http://www.jooq.org/products
Apache License 2.0
2.09k stars 168 forks source link

Add Seq.toMap() with mergeFunction #377

Closed mujun0312 closed 4 years ago

mujun0312 commented 4 years ago

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.

lukaseder commented 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