public static Cons removeDuplicatesFromLongList(Cons self, boolean equaltestP) {
    { int tablesize = Native.ceiling(self.length() * 0.3);
      Cons[] table = new Cons[tablesize];
      Cons cursor = self;
      Stella_Object item = null;
      Cons bucket = null;
      int bucketindex = 0;

      { int i = Stella.NULL_INTEGER;
        int iter000 = 0;
        int upperBound000 = tablesize - 1;

        for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
          i = iter000;
          table[i] = Stella.NIL;
        }
      }
      while (!(cursor == Stella.NIL)) {
        item = cursor.value;
        bucketindex = (((item.hashCode_()) & 0x7FFFFFFF) % tablesize);
        bucket = table[bucketindex];
        { boolean foundP000 = false;

          { Stella_Object it = null;
            Cons iter001 = bucket;

            loop002 : for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              it = iter001.value;
              if ((equaltestP ? Stella_Object.equalP(it, item) : Stella_Object.eqlP(it, item))) {
                foundP000 = true;
                break loop002;
              }
            }
          }
          if (foundP000) {
            cursor.value = null;
          }
          else {
            table[bucketindex] = Cons.cons(item, bucket);
          }
        }
        cursor = cursor.rest;
      }
      return (self.remove(null));
    }
  }