Pre-SIP: A Syntax for Collection Literals

Java doesn’t have collection literals, not even Array literals, all it has is Array initialization with {}. What Java does have is List.of(), which is more verbose than Scala’s List().

Because other languages usually don’t have companion objects with a variadic apply method.

You keep coming back to this “everybody else does it too” rhetoric because at this point it’s impossible to justify this feature in any other way. Again, @JD557 has demonstrated that this can be done as a library. So where exactly is the point of this feature over simply adding something like that to the standard library? As far as I’m concerned, that, together with the overwhelming opposition we’ve seen in this thread really should be the last nail in the coffin for this thing.

2 Likes