Again i was writing Java today, the same things over and over again, and the most popular Java lines are (evolving with my experience, n00b as 'fish, new in town etc.'):
n00b (Java 1.4)
ArrayList al = new ArrayList();
String[] result = new String[al.length()];
for (int i = 0;i < al.length(); i++) {
result[i] = (String)al.get(i);
}
return result;
n00b-- (Java 1.4)
ArrayList al = new ArrayList();
return (String[])al.toArray(new String[] {});
n00b = n00b - 2 (Java 1.5)
ArrayList<String>>al = new ArrayList<String>();
return al.toArray(new String[] {});
n00b = n00b - 3 (Java 1.5)
List<String> l = new ArrayList<String>();
return l.toArray(new String[] {});