this post was submitted on 14 Jun 2023
9 points (100.0% liked)

Java

1394 readers
13 users here now

For discussing Java, the JVM, languages that run on the JVM, and other related technologies.

founded 1 year ago
MODERATORS
top 7 comments
sorted by: hot top controversial new old
[–] Akisamb 8 points 1 year ago (2 children)

I imagine that everybody in this community has seen this JEP, but I'm just so happy that we finally have exhaustive pattern matching in java.

My job has also announced a multi-million plan to get rid of websphere and java 8, so maybe I may even see these features at my job one day ^^

[–] lowleveldata 6 points 1 year ago (1 children)

to get rid of websphere and java 8

haha, I was going to say "cool feature but I'm still on Java 8 / 11"

[–] JackbyDev 3 points 1 year ago (1 children)

In 2014 my first job as a junior developer we were on Java 6 on WebSphere. We didn't even get try-with-resources lol.

[–] MagicShel 2 points 1 year ago

I think in 2014 I was working on Java 5. Then maybe 5 years later we went to 7. Then I changed jobs to a place on 6. Then we migrated to 8.

Since then I think I've had one project on Java 11 and everything else has been Java 8.

I do have a persona side project on Java 20, at least.

[–] JackbyDev 4 points 1 year ago (1 children)

Friend, I pray that you are going to at least Java 17 and not to 11 lol. Heck, if you can wait a few months 21 will be out and you'll have virtual threads! (Actually I can't remember if it is a preview in 21 or not off the top of my head.)

[–] Akisamb 2 points 1 year ago

The target is 17 at the moment, but I'm keeping hope for version 21.

[–] JackbyDev 3 points 1 year ago

Example code from the link for the lazy,

// As of Java 21
static String formatterPatternSwitch(Object obj) {
    return switch (obj) {
        case Integer i -> String.format("int %d", i);
        case Long l    -> String.format("long %d", l);
        case Double d  -> String.format("double %f", d);
        case String s  -> String.format("String %s", s);
        default        -> obj.toString();
    };
}