Stephan van Hulst wrote:So I give up on generic type inference AND my application introduces a new class?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
JEP 269: Convenience Factory Methods for Collections
Define library APIs to make it convenient to create instances of collections
and maps with small numbers of elements, so as to ease the pain of not
having collection literals in the Java programming language
• Decrease the amount of code needed for creating small collections and
maps
core-libs / java.util:collections
Set<String> alphabet = Set.of("a", "b", "c");
Kenneth A. Kousen, Ph.D. (assorted certs),
President, Kousen IT, Inc, http://www.kousenit.com
Kenneth A. Kousen wrote:I think it'll be interesting to see how that affects the way developers code -- they're not necessarily expecting immutable collections from a method like that.
Kenneth A. Kousen, Ph.D. (assorted certs),
President, Kousen IT, Inc, http://www.kousenit.com
Kenneth A. Kousen wrote:Sure, but nothing about the name of the factory method implies that the resulting collection is immutable. For example, I used Arrays.asList(...) for years without realized that also produced an immutable collection.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Kenneth A. Kousen, Ph.D. (assorted certs),
President, Kousen IT, Inc, http://www.kousenit.com
I want my playground back. Here, I'll give you this tiny ad for it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|