| > Easier construction for records will come to Java. Once again: when? And why only records? Why does everything in java require someone to manually create an .of method, or create 15000 setter methods or generate those 15000 setter methods? > This is not true. Lists are collections, and while arrays are different, I remember running into an issue with the difference, but can't remember now. Quite possible it was an artefact of an early implementation. > Arrays.asList() gives you a list view of arrays. Yup. One of the hundreds papercuts that litter Java. C#: var list = new List<string>()
{
"carrot",
"fox",
"explorer"
};
var array = new string[]{ "carrot", "fox", "explorer" };
... use whatever IEnumerable methods on both ...
Java:Ahahaha. No. For lists use a static .of method and be glad that someone manually wrote that in the library. And be thankful that there's some shortcut to create an array. But for Lists? eff off, no shortcuts for you. Oh you want convenience methods on arrays? Ahahaha, no. Use a separate helper to convert into a list first. (This is so bad that IDEA suggests some version .toList as the first method on I swear 90% of array/collection/list/stream operations). Because, as someone said, "our goal isn't to adopt the strategy of less successful products, but to forge our own". I'm really surprised records made it into the language with this approach to things. Edit: Note: Ii use Java and C# interchangeably at my day job. Man is C# a nicer language with literally hundreds of QoL improvements that make you scream "why didn't Java adopt these?" I still reach for Java as I'm more comfortable with it and it has an unparalleled breadth of libraries. But every time I need to write or implement and write another X.builder().setX.setY.setZ.build() instead of `new X { x=.., y=.., z=.. }` I want to claw my eyes out. |