Coding in the small with Google Collections: Iterables.concat()
Part 7 in a Series. Iterables.concat() combines multiple iterables (such as ArrayList and HashSet) so you can go through multiple collections' elements in a single pass: Before: public boolean orderContains(Product product) { List<LineItem> allLineItems = new ArrayList<LineItem>(); allLineItems.addAll(getPurchasedItems(…