gpt4 book ai didi

java - Project Coin 的 Collection 增强功能会出现在 JDK8 中吗?

转载 作者:IT老高 更新时间:2023-10-28 20:47:33 28 4
gpt4 key购买 nike

最初 Project Coinenhanced support for collections例如list[3] 代替 list.get(3)map["hello"] = 27 代替 map.put ("hello", 27) 但他们是 not in jdk7 .他们会在jdk8中吗?我找不到是或否的明确答案。

最佳答案

Brian Goetz 在 5 月 30 日的 Project Lambda 邮件列表中的这篇文章中简要提到了列表、集合、映射(和其他可能的)文字:

http://mail.openjdk.java.net/pipermail/lambda-dev/2012-May/004979.html

To illustrate what I mean by "we could do better", here's an alternative proposal that gets far more mileage out of #: structured literals. While these plans are not in place for 8, we have already stated our desire to add structured literals for lists, maps, sets, etc. # as a prefix symbol, combined with delimiters, gives us a far higher return-on-syntax as a structured literal builder (as a bonus, # is already associated with structured literals in a lot of languages, going all the way back to many early assembly languages where # was the immediate addressing mode.)

所以在我看来,即使是集合文字也无法进入 JDK 8,更不用说 get/set/put 运算符了。可惜了。

我也没有在 JDK 8 里程碑列表中看到任何与集合文字或新运算符相关的内容:

http://openjdk.java.net/projects/jdk8/milestones

关于java - Project Coin 的 Collection 增强功能会出现在 JDK8 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13692213/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com