Idea for Collection Literals

David Holmes david.holmes at oracle.com
Wed Jan 5 12:22:05 UTC 2022


Hi,

On 5/01/2022 10:17 am, Izz Rainy wrote:
> Hello! Hopefully this is the right place for this suggestion - if it isn't,
> please let me know.

It isn't the right place, please use core-libs-dev at openjdk.java.net.

Thanks,
David

> Recently, I've read some of the discussion linked in JEP 269 (Convenience
> Factory Methods for Collections), including why Collection Literals were
> shelved when brought up in Project Coin and Lambda. I believe that things
> may be different enough now (with dynamic constants possible, local
> variable inference and lambdas present, value types closer to completion,
> and project Amber bringing "smaller" features under consideration) to bring
> them up yet again.
> 
> I've tried writing an informal proposal for them that tries to answer the
> main questions brought up in those original discussions:
> https://gist.github.com/l-Luna/08b6574d0c840de93634cf8d1e43c494
> 
> It tries to stay general to multiple kinds of collections (so long as they
> are either "list like" or "map like"), without trying to be too open ended,
> and includes ways of clearly specifying the target type and mutability,
> while also trying to infer a reasonable default for both.
> 
> I understand that it's still unlikely to be added in the near future, but
> thought it wouldn't hurt to bring up again.


More information about the discuss mailing list