001package edu.pdx.cs410J.core;
002
003// All classes not in java.lang must be imported
004import java.util.*;
005
006/**
007 * This class demonstrates several of the collection classes.
008 */
009public class Collections {
010
011  /**
012   * Prints the contents of a <code>Collection</code>
013   */
014  private static void print(Collection c) {
015    Iterator iter = c.iterator();
016    while (iter.hasNext()) {
017      Object o = iter.next();
018      System.out.println(o);
019    }
020  }
021
022  public static void main(String[] args) {
023    Collection<String> c = new ArrayList<>();
024    c.add("One");
025    c.add("Two");
026    c.add("Three");
027    print(c);
028    System.out.println("");
029
030    Set<String> set = new HashSet<>(c);
031    set.add("Four");
032    set.add("Two");
033    print(set);
034  }
035
036}