Example #1
0
 /**
  * Returns a shallow copy of this {@code HashSet} instance: the elements themselves are not
  * cloned.
  *
  * @return a shallow copy of this set
  */
 @SuppressWarnings("unchecked")
 public Object clone() {
   try {
     HashSet<E> newSet = (HashSet<E>) super.clone();
     newSet.map = (HashMap<E, Object>) map.clone();
     return newSet;
   } catch (CloneNotSupportedException e) {
     throw new InternalError(e);
   }
 }