News for hackers. Stuff that matters.
Re:Java 18 / JDK 18: General Availability by freedomben on Tuesday March 22, 2022 @11:55AM (#30767620)
It's legitimately fascinating to see the rise of pattern matching, to the point that even Java will have it [1]! Combined with lambdas, this is a different language than the Java 1.5 that I first learned. If you would have told me that this would be valid Java code:

    static void testStringOrNull(Object o) {
        switch (o) {
            case null, String s -> System.out.println("String: " + s);
        }
    }
I would never have believed you. And while it's not Elixir-level pattern matching, it's not toothless either. This is valid pattern matching code too:

    static void testTriangle(Shape s) {
        switch (s) {
            case Triangle t && (t.calculateArea() > 100) ->
                System.out.println("Large triangle");
            default ->
                System.out.println("A shape, possibly a small triangle");
        }
    }
[1]: https://openjdk.java.net/jeps/420
Re:Java 18 / JDK 18: General Availability by shepherdjerred on Tuesday March 22, 2022 @12:55PM (#30768515)
Everything since Java 7 has been a pleasure. The language is so much more mature now. The only problem is enterprise companies giving it a bad name, but I guess that's the price you pay for its broad usage.
Re:Java 18 / JDK 18: General Availability by freedomben on Tuesday March 22, 2022 @04:59PM (#30771470)
Do you think Enterprises will ever give up the mountain of "design patterns" that (IMHO) make Java less desirable to work in? The Enterprise FizzBuzz is funny because of how true it is [1].

[1]: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

Re:Java 18 / JDK 18: General Availability by evacchi on Tuesday March 22, 2022 @01:25PM (#30768917)
record patterns may come as soon as JDK 19 https://openjdk.java.net/jeps/405 fingers crossed!
Re:Java 18 / JDK 18: General Availability by Angius on Tuesday March 22, 2022 @12:34PM (#30768223)
Java turning more and more into poor man's C# with each release
Re:Java 18 / JDK 18: General Availability by azth on Tuesday March 22, 2022 @01:57PM (#30769292)
More like a very reasonable C# that fits in your head :) Even C# programmers are complaining about feature creep.

Java's Project Loom will be superior to C#'s async/await.