public int[] toArray() {
    int[] result = new int[size];
    SetIterator iterator = iterator();
    int i = 0;
    while (iterator.hasNext()) {
      result[i++] = iterator.nextInt();
    }
    return result;
  }
public int[] toArray()