public Object clone() throws CloneNotSupportedException {
    HashSetOfArray result = (HashSetOfArray) super.clone();
    result.elementSize = this.elementSize;
    result.threshold = this.threshold;

    int length = this.set.length;
    result.set = new Object[length][];
    System.arraycopy(this.set, 0, result.set, 0, length);

    return result;
  }
  private void rehash() {

    HashSetOfArray newHashSet =
        new HashSetOfArray(elementSize * 2); // double the number of expected elements
    Object[] currentArray;
    for (int i = this.set.length; --i >= 0; )
      if ((currentArray = this.set[i]) != null) newHashSet.add(currentArray);

    this.set = newHashSet.set;
    this.threshold = newHashSet.threshold;
  }