public void union(FlowSet otherFlow, FlowSet destFlow) {
    if (sameType(otherFlow) && sameType(destFlow)) {
      ArraySparseSet other = (ArraySparseSet) otherFlow;
      ArraySparseSet dest = (ArraySparseSet) destFlow;

      // For the special case that dest == other
      if (dest == other) {
        for (int i = 0; i < this.numElements; i++) dest.add(this.elements[i]);
      }

      // Else, force that dest starts with contents of this
      else {
        if (this != dest) copy(dest);

        for (int i = 0; i < other.numElements; i++) dest.add(other.elements[i]);
      }
    } else super.union(otherFlow, destFlow);
  }
 public void union(FlowSet other) {
   union(other, this);
 }