code: public synchronized IMolecularFormulaSet getAllFormulas() {
  
          final IMolecularFormulaSet result = builder
                  .newInstance(IMolecularFormulaSet.class);
          IMolecularFormula nextFormula;
          while ((nextFormula = getNextFormula()) != null) {
              result.addMolecularFormula(nextFormula);
          }
          return result;
      }
docs: Generates a {@link IMolecularFormulaSet} by repeatedly calling {@link
  FullEnumerationFormulaGenerator#getNextFormula()} until all possible formulas are generated. There is no
  guaranteed order to the formulas in the resulting
  {@link IMolecularFormulaSet}.
  
  Note: if some formulas were already generated by calling {@link
  FullEnumerationFormulaGenerator#getNextFormula()} on this MolecularFormulaGenerator instance, those
  formulas will not be included in the returned
  {@link IMolecularFormulaSet}.
  
  @see #getNextFormula()