RFR 9: JDK-8040892 Incorrect message in Exception thrown by Collectors.toMap(Function, Function)

Paul Sandoz paul.sandoz at oracle.com
Mon Apr 28 10:54:49 UTC 2014

On Apr 28, 2014, at 12:30 PM, Peter Levart <peter.levart at gmail.com> wrote:
> You could use the null return from Map.merge() as a signal to throw NPE, but this is only 100% safe in to*Map() methods that don't take a mapSupplier.
> Collections.toConcurrentMap(...., Supplier<M> mapSupplier) could be abused by someone knowing that the supplier is called exactly once and that the returned map is the same instance returned from the supplier. For example:

I don't think we should concern ourselves with such abuses :-)

     * @param mapSupplier a function which returns a new, empty {@code Map} into
     *                    which the results will be inserted

More information about the core-libs-dev mailing list