RFR: JDK-8134373: explore potential uses of convenience factories within the JDK
Patrick Reinhart
patrick at reini.net
Thu Sep 15 12:33:51 UTC 2016
Hello together,
I tried to process all suggested change input into the following new
webrev:
http://cr.openjdk.java.net/~reinhapa/reviews/8134373/webrev.01
Give me feedback if something is missing/wrong
-Patrick
On 2016-09-15 13:48, Pavel Rappo wrote:
> Daniel, Claes,
>
> List.of() and Collections.emptyList() are not the same. The behaviours
> are
> different. Moreover, immutable static factory methods return instances
> which are
> value-based. I believe it also means we are not tied with unconditional
> instantiation, and in case of empty collections/maps could probably
> return the
> same object every time.
>
> We should ask Stuart why it has been done like that in the first place.
> Maybe
> out of concern people might synchronize of those objects? I don't know.
> Let's
> say for now it's an implementation-specific detail.
>
>> On 15 Sep 2016, at 12:35, Claes Redestad <claes.redestad at oracle.com>
>> wrote:
>>
>> +1
>>
>> I don't mind List.of() aesthetically, but there are places where
>> startup/footprint is important where Collections.emptyList()
>> is simply superior, e.g., constituting permanent data structures
>> such as the module graph during early bootstrap.
>>
More information about the core-libs-dev
mailing list