`var a = Set.of(1, 2)`
works just fine in Java.
Perhaps I’m being too critical.
In python you can also do
s = set()
s.add(1)
s.add(2)
and s = set(x for x in [1, 2])
But I wouldn't call that having three ways to do the same.Disclaimer: I don't know java well, just commenting based on the comments above and my python knowledge.
>it's common to find Java code written like in my example because the syntax for sets in Java came after Java 8
So I think we went full circle back to GP claim:
> The language itself is quite beautiful when used properly and with modern features
:)