Example #1
0
  /**
   * Returns a shallow copy of this {@code TreeSet} instance. (The elements themselves are not
   * cloned.)
   *
   * @return a shallow copy of this set
   */
  public Object clone() {
    TreeSet<E> clone = null;
    try {
      clone = (TreeSet<E>) super.clone();
    } catch (CloneNotSupportedException e) {
      throw new InternalError();
    }

    clone.m = new TreeMap<E, Object>(m);
    return clone;
  }