Browse - Programming Tips - How can I concatenate two ArrayLists?

Date: 2012nov2
Language: java
Keywords: add, attach, join

Q.  How can I concatenate two ArrayLists?

A.  Here's a method that does that:

ArrayList<String> concat(ArrayList<String> a, ArrayList<String> b) { ArrayList<String> out = new ArrayList<String>(); out.addAll(a); out.addAll(b); return out; }