RFR: JDK-8306860: Avoid unnecessary allocation in List.map() when list is empty

Lalit Prakash Vatsal duke at openjdk.org
Tue Apr 25 15:41:55 UTC 2023


On Mon, 10 Apr 2023 17:38:23 GMT, Christoph Dreis <duke at openjdk.org> wrote:

>> I meant the list on which `map(…)` is called.
>
> Same "problem". This changes behaviour compared to what it does now. I don't have anything against that per se, but an optimization imho shouldn't really change the behaviour.

I agree with @dreis2211 here. Someone might want to use/mutate the returned `List` later on.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13407#discussion_r1161932177


More information about the compiler-dev mailing list