/**
   * Returns a formatted string version of this set Examples: If set contains "a" and "b", this
   * method should return the string "{a, b}". If the set is empty, this method should return the
   * string "{}".
   */
  public String toString() {
    String result = "{";
    if (size() > 0) result += data.get(0);

    for (int i = 1; i < data.size(); i++) result += ", " + data.get(i);

    return result + "}";
  }
 /**
  * Removes e from the set, and throws an IllegalArgumentException if e is null
  *
  * @param e
  */
 public void remove(String e) {
   if (e == null) throw new IllegalArgumentException();
   for (int i = 0; i < data.size(); i++) {
     if (data.get(i).equals(e)) {
       data.remove(i);
       break;
     }
   }
 }
 /**
  * Indicates whether the set contains e, and throws an IllegalArgumentException if e is null.
  *
  * @param e
  * @return true if the set contains e
  */
 public boolean contains(String e) {
   if (e == null) throw new IllegalArgumentException();
   boolean exist = false;
   for (int i = 0; i < data.size(); i++) {
     if (data.get(i).equals(e)) {
       exist = true;
     }
   }
   return exist;
 }
 /**
  * Adds e to the set if there is not already an element in the set equal to e.Plus,throws an
  * IllegalArgumentException if e is null
  *
  * @param e
  */
 public void insert(String e) {
   if (e == null) throw new IllegalArgumentException();
   // don't add the string if it already exists
   if (contains(e)) {
     return;
   } else {
     data.add(e);
   }
 }
 // Returns the number of strings in the set
 public int size() {
   return data.size();
 }