Re:Gosu – A pragmatic language for the JVM
by carsongross on Thursday July 24, 2014 @11:20AM
(#8080024)
You can do that the way you'd expect:
var strings = new ArrayList<String>() { "red", "green", "blue" }Thanks. That's interesting. Is there a global setting to always use ArrayList instead of List? Actually maybe global is too much... per file setting.
So by default the type inferred is ArrayList, if you want a different type you just specify it.
ex. var strings = { "red", "green", "blue" } //ArrayList
var strings2 : LinkedList<String> = { "red", "green", "blue" }
var strings = { "red", "green", "blue" }
uses. In some clean way. eg I don't want List, I want ArrayList.