I wanted to create a list of options for testing purposes. At first, I did this:
ArrayList places = new ArrayList();
places.add(\
Why not make a simple utility function that does this?
static ArrayList ll(A... a) {
ArrayList l = new ArrayList(a.length);
for (A x : a) l.add(x);
return l;
}
"ll
" stands for "literal list".
ArrayList places = ll("Buenos Aires", "Córdoba", "La Plata");