(String[] args)
| 7 | |
| 8 | public class ForInCollections { |
| 9 | public static void main(String[] args) { |
| 10 | Collection<String> cs = new LinkedList<>(); |
| 11 | Collections.addAll(cs, |
| 12 | "Take the long way home".split(" ")); |
| 13 | for(String s : cs) |
| 14 | System.out.print("'" + s + "' "); |
| 15 | } |
| 16 | } |
| 17 | /* Output: |
| 18 | 'Take' 'the' 'long' 'way' 'home' |