StringBuilder b = new StringBuilder(); for (Iterator i = list.iterator(); i.hasNext(); ) { b.append(i.next()) .append(" "); } return b.toString();
List list = new ArrayList(); list.add("I"); list.add("play"); list.add("Bourgeois"); list.add("guitars"); list.add("and"); list.add("Huber"); list.add("banjos"); System.out.println(StringBuilderTester.appendItems(list));