Does Java offer a way to do something like the following without resorting to declaring the array in a separate variable?
for (String s : {"HEY", "THERE"}) {
// ...
}
The best I can come up with is:
for (String s : new ArrayList<String>() {{ add("HEY"); add("THERE"); }}) {
// ...
}
which isn't pretty.