* @param equaltestP
   * @return HashSet
   */
  public static HashSet coerceToHashSet(Stella_Object self, boolean equaltestP) {
    { HashSet chooseValue000 = null;

      if (Stella_Object.isaP(self, Stella.SGT_STELLA_HASH_SET)) {
        chooseValue000 = ((HashSet)(self));
      }
      else {
        { HashSet self000 = HashSet.newHashSet();

          self000.equalTestP = equaltestP;
          chooseValue000 = self000;
        }
      }
      { HashSet theset = chooseValue000;

        { Surrogate testValue000 = Stella_Object.safePrimaryType(self);

          if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_HASH_SET)) {
            { HashSet self001 = ((HashSet)(self));

            }
          }
          else if (testValue000 == Stella.SGT_STELLA_CONS) {
            { Cons self001 = ((Cons)(self));

              { Stella_Object elt = null;
                Cons iter000 = self001;

                for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                  elt = iter000.value;
                  theset.insertAt(elt, elt);
                }
              }
            }
          }
          else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_LIST)) {
            { List self001 = ((List)(self));

              { Stella_Object elt = null;
                Cons iter001 = self001.theConsList;

                for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                  elt = iter001.value;
                  theset.insertAt(elt, elt);
                }
              }
            }
          }
          else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_VECTOR)) {
            { Vector self001 = ((Vector)(self));

              { Stella_Object elt = null;
                Vector vector000 = self001;
                int index000 = 0;
                int length000 = vector000.length();

                for (;index000 < length000; index000 = index000 + 1) {
                  elt = (vector000.theArray)[index000];
                  theset.insertAt(elt, elt);
                }
              }
            }
          }
          else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_COLLECTION)) {
            { Collection self001 = ((Collection)(self));

              { Stella_Object elt = null;
                Iterator iter002 = ((Iterator)(self001.allocateIterator()));

                while (iter002.nextP()) {
                  elt = iter002.value;
                  theset.insertAt(elt, elt);
                }
              }
            }
          }
          else {
            { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print("coerce-to-hash-set: don't know how to coerce a `" + self.primaryType() + "' into a hash-set");
              throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
            }
          }
        }
        return (theset);
      }
    }
  }