/** * Returns a shallow copy of this <tt>HashSet</tt> instance: the elements themselves are not * cloned. * * @return a shallow copy of this set. */ public Object clone() { try { HashSet newSet = (HashSet) super.clone(); newSet.map = (HashMap) map.clone(); return newSet; } catch (CloneNotSupportedException e) { throw new InternalError(); } }