Timeline for var args constructors/methods vs lists
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 11, 2013 at 17:20 | comment | added | kevin cline | -1: Maybe true, but Java isn't a modern language. Modern languages have convenient syntax for List and Map literals. Java does not, so using varargs is often the most convenient. | |
| Feb 11, 2013 at 12:34 | comment | added | gnat | I thought like you before ("it's-all-a-useless-syntactic-sugar blah blah"), but after having recently reviewed diffs of about 200 files migrated from Java 4 (no varargs) to more modern version (with varargs), I don't think so anymore | |
| Feb 11, 2013 at 11:08 | vote | accept | Sergio | ||
| Feb 11, 2013 at 12:37 | |||||
| Feb 10, 2013 at 23:31 | comment | added | user7043 | With varargs, I don't have to explicitly assemble a collection if I already have the items. Even with the most convenient syntax available in C# right now, it's Foo(new List<SomeHugeType> {param1, param2}) versus Foo(param1, param2). And ambiguity of calls is more effectively battled by restricting overloading in general ;-) | |
| Feb 10, 2013 at 21:46 | history | answered | Ross Patterson | CC BY-SA 3.0 |