Remix.run Logo
pgwhalen 3 days ago

Java's biggest risk towards continued adoption, by far, is the culture surrounding it - old Java programmers and old Java programs continue to be needlessly verbose, even if the language now has the tools (pretty much) to be as terse as other popular, modern languages.

It's an uphill battle, but it might just climb the hill because it's still such a behemoth.

eastbound 2 days ago | parent [-]

It all failed when .stream() appeared. Why make people use .stream() for functional programming, plus streams aren’t even reusable, I almost wish they invented a new operator based on an exotic UTF-8 character than those 9 extra characters. Fonts should have a ligature for .stream().

And now let’s talk about .collect(toList())…

And records which look like ugly beans…

Java is the land of the verbose. But it can probably be solved with 9 extra characters on every line.

lenkite 2 days ago | parent | next [-]

Nobody complains about the Rust turbo-fish operator which is pretty verbose too. Java has already has introduced a direct toList()/toArray() anyways.

    let v = (1..5).collect::<Vec<i32>>(); // Cool Rust
eastbound a day ago | parent [-]

Streams should be built in collections, not a .stream().map(…).toList() convolution. In know its incompatible with weird frameworks who already overloaded the .map() method, but well… let them recompile.

That was in 2008, we’d be happy by now; and Java had no qualms asking everyone to change the package names from javax’ to jakartax’ in Java 21, so they should have issued a java.collections package and deprecated the lists i java.utils.

erkkonet 2 days ago | parent | prev | next [-]

starting with JDK 16, Stream has .toList() that will save you ten characters for the .collect()

never_inline 2 days ago | parent | prev [-]

It's very difficult for a language designer to satisify the aesthetes.