import java.util.ArrayList;

/**
 * Provides a simple to-do list.
 *
 * A to-do list is just a list of Strings.  New items can be added
 * to the end of the list.  Completed items can be removed from
 * the beginning of the list.
 *
 * @author Zach Tomaszewski
 * @version 17 Mar 2008
 */
public class SimpleToDoList {

  private ArrayList<String> list;


  public SimpleToDoList() {
    list = new ArrayList<String>();
  }


  /**
   * Adds the given item to the end of this todo list.
   */
  public void add(String item) {
    list.add(item);
  }

  /**
   * Removes the first item from this todo list.
   * Returns the item so removed.  If the list was empty, returns null instead.
   */
  public String remove() {
    if (list.size() > 0) {
      return list.remove(0);
    }else {
      return null;
    }
  }

  /**
   * Returns a string representation of this todo list,
   * listing one item per line.  If the list is empty,
   * returns an empty string.
   */
  public String toString() {
    String output = "";
    for (int i = 0; i < list.size(); i++) {
      output += "* " + list.get(i) + "\n";
    }
    return output;
  }

}